Introduction
In order to see the list of supported Azure regions for you current subscription you can use “az account list-locations” command from https://shell.azure.com or Azure CLI. The output of command will show complete list of regions in JSON format like below
{
"displayName": "North Central US",
"id": "/subscriptions/b6aa3c6b-a99b-48dc-9051-1d499e8641/locations/northcentralus",
"metadata": {
"geographyGroup": "US",
"latitude": "41.8819",
"longitude": "-87.6278",
"pairedRegion": [
{
"id": "/subscriptions/b6aa3c6b-a99b-48dc-9051-122d499e8641/locations/southcentralus",
"name": "southcentralus",
"subscriptionId": null
}
],
"physicalLocation": "Illinois",
"regionCategory": "Recommended",
"regionType": "Physical"
},
"name": "northcentralus",
"regionalDisplayName": "(US) North Central US",
"subscriptionId": null
}
Format the Output Result
In order to get the output in table format we can use below command
az account list-locations -o table
Fig: Azure Locations List - Formatted Output
Find specific columns:
Use the below query to find specific columns. See http://jmespath.org/ for more information and examples. To get more column names(like displayName, name or regionalDisplayName) use “az account list-locations" command.
az account list-locations --query "[].{DisplayName:displayName, Name:name,region:regionalDisplayName}" -o table
Sort data by Name
We can sort the table data using below command. Below command shows sorting by Name.
az account list-locations --query "sort_by([].{DisplayName:displayName, Name:name}, &Name)" --output table