Reputation: 329
Any az cli command in general to get to know count (1?2?3?) of availability zones in a particular region of Azure? I am trying to get these details for EventGrid and event hub specifically..
Upvotes: 0
Views: 251
Reputation: 7818
Count of Availability Zones in Each region:
To list out the locations and availability zones, use below CLI command.
az account list-locations -o table
To list out the locations and availability zones in eastUS
region, use below CLI command.
az account list-locations -o table --query "[?name=='eastus']"
To count the number of availability zones, use length([])
function as shown.
az account list-locations -o table --query "length([])"
To retrieve availability zones and their counts for any specific resources, use below CLI commands: (Eg: EventHub)
az eventhubs eventhub list --resource-group <resourcegroup> --namespace-name <Namespace> --query "[?contains('Location', 'WestUS')]" -o table
az resource list --resource-group <resourcegroup> --name <resourceName> --resource-type Microsoft.EventGrid/domains --query "length([])"
Upvotes: 1