In this Microsoft Azure Az PowerShell blog post, we will show how to list all Azure regions using PowerShell
Azure regions are a fundamental aspect of Microsoft Azure’s global infrastructure, designed to deliver a wide range of cloud services to users worldwide.
Each Azure region is a set of data centers deployed within a latency-defined perimeter and connected through a dedicated regional low-latency network.
This geographical distribution of data centers helps ensure that Azure services are highly available, resilient, and scalable. Importantly, it also allows customers to meet their local data residency requirements by providing the option to store data in specific regions.
As of now, Azure spans numerous regions across the globe, each offering multiple services, including compute, storage, and networking capabilities, thereby supporting both broad and localized compliance with regulations and standards.
Az PowerShell
This post will use the Microsoft Az PowerShell module, which runs on PowerShell and is available on Windows, Linux, and macOS. If you don’t have the module installed on your host, install it.
Regions
As of writing these lines, Microsoft Azure’s global network of regions has 42 locations available for deployment at any given moment.
List All Azure Regions Using PowerShell
To list all the Azure regions, first log into Azure using the following command. (Note: If you are on macOS or Linux, run pwsh to start PowerShell).
login-azaccount
To list all the available regions, run the following command.
Get-AzLocation | select displayname,location
The full output is listed below. If you need to use a region, a PowerShell script or Terraform configuration, use the name in the location column.
DisplayName Location
----------- --------
East Asia eastasia
Southeast Asia southeastasia
Central US centralus
East US eastus
East US 2 eastus2
West US westus
North Central US northcentralus
South Central US southcentralus
North Europe northeurope
West Europe westeurope
Japan West japanwest
Japan East japaneast
Brazil South brazilsouth
Australia East australiaeast
Australia Southeast australiasoutheast
South India southindia
Central India centralindia
West India westindia
Canada Central canadacentral
Canada East canadaeast
UK South uksouth
UK West ukwest
West Central US westcentralus
West US 2 westus2
Korea Central koreacentral
Korea South koreasouth
France Central francecentral
France South francesouth
Australia Central australiacentral
Australia Central 2 australiacentral2
UAE Central uaecentral
UAE North uaenorth
South Africa North southafricanorth
South Africa West southafricawest
Switzerland North switzerlandnorth
Switzerland West switzerlandwest
Germany North germanynorth
Germany West Central germanywestcentral
Norway West norwaywest
Norway East norwayeast
Brazil Southeast brazilsoutheast
West US 3 westus3
Watch the YouTube Video Version of this post
Updated code
# Import the Azure module
Import-Module Az
# Get all Azure regions
$regions = Get-AzLocation | Select-Object DisplayName, location
# Count the number of regions
$regionCount = $regions.Count
# Format the table with green and yellow colors
$regions | Format-Table -AutoSize -Property DisplayName, location
# Display the region count
Write-Host "Number of regions: $regionCount"
$regions | Format-Table -AutoSize -Property DisplayName, location