List All Azure Regions Using PowerShell

In this Microsoft Azure Az PowerShell blog post, we will learn how to list all the Azure regions available for deployments.

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 Regions

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


Posted

in

, , ,

by