Roman Klimenko
DA

List Azure resource locations

Azure resources

azure.microsoft.com/en-us/global-infrastructure/geographies/

To create a new resource group with Azure CLI, use:

az group create --location westus -name MyResourceGroup

To create the group in Europe or Asia, you need to know which location name to use instead of westus.

List all available locations with:

az account list-locations

You will get a long output like this:

[
  // ...
  {
    "displayName": "Brazil Southeast",
    "id": "/subscriptions/.../locations/brazilsoutheast",
    "metadata": {
      "geographyGroup": "South America",
      "latitude": "-22.90278",
      "longitude": "-43.2075",
      "pairedRegion": [
        {
          "id": "/subscriptions/.../locations/brazilsouth",
          "name": "brazilsouth",
          "subscriptionId": null
        }
      ],
      "physicalLocation": "Rio",
      "regionCategory": "Other",
      "regionType": "Physical"
    },
    "name": "brazilsoutheast",
    "regionalDisplayName": "(South America) Brazil Southeast",
    "subscriptionId": null
  }
]

This output is hard to scan. If you only need each location's name, use the --query parameter:

az account list-locations --query "[*].name"

The output is much easier to read:

[
  "eastus",
  "eastus2",
  "southcentralus",
  "westus2",
  "australiaeast",
  // ...
  "norwaywest",
  "switzerlandwest",
  "ukwest",
  "uaecentral",
  "brazilsoutheast"
]

You can also sort the list alphabetically:

az account list-locations --query "[*].name" --out tsv | sort

Output:

asia
asiapacific
australia
australiacentral
australiacentral2
australiaeast
australiasoutheast
brazil
brazilsouth
brazilsoutheast
canada
canadacentral
canadaeast
centralindia
centralus
centraluseuap
centralusstage
eastasia
eastasiastage
eastus
eastus2
eastus2euap
eastus2stage
eastusstage
europe
francecentral
francesouth
germanynorth
germanywestcentral
global
india
japan
japaneast
japanwest
jioindiawest
koreacentral
koreasouth
northcentralus
northcentralusstage
northeurope
norwayeast
norwaywest
southafricanorth
southafricawest
southcentralus
southcentralusstage
southeastasia
southeastasiastage
southindia
switzerlandnorth
switzerlandwest
uaecentral
uaenorth
uk
uksouth
ukwest
unitedstates
westcentralus
westeurope
westindia
westus
westus2
westus2stage
westus3
westusstage

In PowerShell, you can filter the output like this:

az account list-locations --query "[*].name" `
    | ConvertFrom-Json `
    | sort `
    | where { $_ -like "*europe*" }

Output:

europe
northeurope
westeurope