0

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..

ABC DEF
  • 189
  • 2
  • 14

1 Answers1

1

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

enter image description here

To list out the locations and availability zones in eastUS region, use below CLI command.

az account list-locations -o table --query "[?name=='eastus']"

enter image description here

To count the number of availability zones, use length([]) function as shown.

az account list-locations -o table --query "length([])"

enter image description here

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([])"
Jahnavi
  • 3,076
  • 1
  • 3
  • 10