List all Azure Regions using PowerShell | Azure Cloud Shell

In this post, I will show you how to list all Azure regions using PowerShell. You can also use Azure Cloud Shell to get a list of all Azure regions along with physical location and geography group details.

Each Azure geography contains one or more regions and meets specific data residency and compliance requirements. From the Azure Portal, it is difficult to list all the Azure Regions and this is where PowerShell is useful.

Most of the configuration in Azure can be done with Azure Portal. However, in some situations using PowerShell commands makes your tasks easier. Thankfully, the PowerShell automation is supported through the Azure Portal.

To manage Azure using PowerShell you must first install Azure PowerShell module. There are different ways to install Azure PowerShell module. You could choose any of these methods listed below:

  1. Azure PowerShell from WebPI. Download Azure PowerShell and start the install.
  2. Using PowerShell Gallery
  3. Download MSI installer from GitHub

Get-AzLocation PowerShell Cmdlet

The Get-AzLocation cmdlet gets all locations and the supported resource providers for each location. When you run the Get-AzLocation command, you get the output that includes the following information.

  • Providers
  • Location
  • DisplayName
  • Type
  • Longitude
  • Latitude
  • PhysicalLocation
  • RegionType
  • RegionCategory
  • GeographyGroup
  • PairedRegion

The Get-AzLocation cmdlet supports the following parameters:

  • -Pre
  • -ExtendedLocation
  • -DefaultProfile
  • -ApiVersion

List all Azure Regions using PowerShell

Let’s see the steps to list all Azure regions using PowerShell. Assuming that you have installed the Azure module for PowerShell, launch the PowerShell on your computer and run the below command.

Login-AzAccount

After you enter the above command, Microsoft Azure sign-in window appears which requires you to enter the credentials to log in to Azure.

You can also use Connect-AzAccount cmdlet which Connects to Azure with an authenticated account for use with cmdlets from the Az PowerShell modules.

Enter the email and password to connect to Azure and log in to Azure account.

Connect to Azure
Connect to Azure

Run the following to command in the PowerShell window to get all the Azure regions.

Get-AzLocation | select displayname,location
List all Azure Regions using PowerShell
List all Azure Regions using PowerShell

List all Azure Regions using Cloud Shell

By connecting to Azure Cloud Shell, you can run a simple PowerShell command to list all Azure regions. From the Azure portal, connect to Cloud Shell.

Connect to Azure Cloud Shell
Connect to Azure Cloud Shell

Wait while the connection to cloud shell succeeds.

Requesting a Cloud Shell.Succeeded. 
Connecting terminal...
MOTD: Customize your experience: save your profile to $HOME/.config/PowerShell
VERBOSE: Authenticating to Azure ...
VERBOSE: Building your Azure drive ...
Connect to Azure Cloud Shell
Connect to Azure Cloud Shell

Run the following to command in Cloud Shell to get all the Azure regions.

Get-AzLocation | select displayname,location
List all Azure Regions using Cloud Shell
List all Azure Regions using Cloud Shell

The command output now shows the DisplayName and Location of all the Azure regions.

List all Azure Regions using Cloud Shell
List all Azure Regions using Cloud Shell

Get all Azure Services in a Specific Region

The below command is useful when you want to view all the services in a particular region.

$providers = Get-AzLocation | Where-Object {$_.Location -eq "eastus2"} | select Providers
$providers.Providers
Get all Azure Services In a Specific Region
Get all Azure Services In a Specific Region
Microsoft.DevTestLab
Microsoft.AAD
Microsoft.OperationalInsights
Microsoft.Security
Microsoft.Network
Microsoft.Compute
Microsoft.Storage
Microsoft.ClassicCompute
Microsoft.OperationsManagement
Microsoft.ManagedIdentity
microsoft.aadiam
Microsoft.AnalysisServices
Microsoft.ApiManagement
Microsoft.App
Microsoft.AppConfiguration
Microsoft.AppPlatform
Microsoft.Attestation
Microsoft.Automanage
Microsoft.Automation
Microsoft.AVS
Microsoft.AzureArcData
Microsoft.AzureCIS
Microsoft.AzureData
Microsoft.AzureSphere
Microsoft.AzureSphereGen2
Microsoft.AzureStackHCI
Microsoft.BackupSolutions
Microsoft.BareMetalInfrastructure
Microsoft.Batch
Microsoft.Cache
Microsoft.Cdn
Microsoft.Chaos
Microsoft.ClassicInfrastructureMigrate
Microsoft.ClassicNetwork
Microsoft.ClassicStorage
Microsoft.CloudTest
Microsoft.CognitiveServices
Microsoft.Confluent
Microsoft.ContainerInstance
Microsoft.ContainerRegistry
Microsoft.ContainerService
Microsoft.D365CustomerInsights
Microsoft.Dashboard
Microsoft.Databricks
Microsoft.DataCollaboration
Microsoft.DataFactory
Microsoft.DataLakeAnalytics
Microsoft.DataLakeStore
Microsoft.DataMigration
Microsoft.DataProtection
Microsoft.DataShare
Microsoft.DBforMariaDB
Microsoft.DBforMySQL
Microsoft.DBforPostgreSQL
Microsoft.DelegatedNetwork
Microsoft.DeploymentManager
Microsoft.DesktopVirtualization
Microsoft.Devices
Microsoft.DeviceUpdate
Microsoft.DevOps
Microsoft.DigitalTwins
Microsoft.DocumentDB
Microsoft.Elastic
Microsoft.EventGrid
Microsoft.EventHub
Microsoft.ExtendedLocation
Microsoft.Fidalgo
Microsoft.HanaOnAzure
Microsoft.HardwareSecurityModules
Microsoft.HDInsight
Microsoft.HealthBot
Microsoft.HealthcareApis
Microsoft.HybridCompute
Microsoft.HybridConnectivity
Microsoft.ImportExport
microsoft.insights
Microsoft.IoTCentral
Microsoft.IoTSecurity
Microsoft.KeyVault
Microsoft.Kubernetes
Microsoft.KubernetesConfiguration
Microsoft.Kusto
Microsoft.LabServices
Microsoft.LoadTestService
Microsoft.Logic
Microsoft.MachineLearning
Microsoft.MachineLearningServices
Microsoft.Maintenance
Microsoft.Maps
Microsoft.Media
Microsoft.Migrate
Microsoft.MixedReality
Microsoft.Monitor
Microsoft.NetApp
Microsoft.NetworkFunction
Microsoft.NotificationHubs
Microsoft.OpenLogisticsPlatform
Microsoft.Peering
Microsoft.PlayFab
Microsoft.Portal
Microsoft.PowerBI
Microsoft.PowerBIDedicated
Microsoft.Purview
Microsoft.RecoveryServices
Microsoft.RedHatOpenShift
Microsoft.Relay
Microsoft.Resources
Microsoft.Search
Microsoft.SecurityDetonation
Microsoft.SerialConsole
Microsoft.ServiceBus
Microsoft.ServiceFabric
Microsoft.ServiceFabricMesh
Microsoft.ServiceLinker
Microsoft.ServicesHub
Microsoft.SignalRService
Microsoft.Singularity
Microsoft.Solutions
Microsoft.Sql
Microsoft.SqlVirtualMachine
Microsoft.StorageCache
Microsoft.StoragePool
Microsoft.StorageSync
Microsoft.StreamAnalytics
microsoft.support
Microsoft.Synapse
Microsoft.TimeSeriesInsights
Microsoft.VideoIndexer
Microsoft.VirtualMachineImages
microsoft.visualstudio
Microsoft.Web
Microsoft.Workloads
NGINX.NGINXPLUS
Wandisco.Fusion

Leave a Reply

Your email address will not be published. Required fields are marked *