Skip to content

Instantly share code, notes, and snippets.

@danuw
Last active June 29, 2024 23:34
Show Gist options
  • Save danuw/0983f4282aa760492037bb70f27ce5c5 to your computer and use it in GitHub Desktop.
Save danuw/0983f4282aa760492037bb70f27ce5c5 to your computer and use it in GitHub Desktop.
az cli commands to extract azure regions and their locations
# copy paste in terminal - this excludes locations that have no coordinates - usually called Logical regions (like USA, Europe, Asia etc...)
#az account list-locations --query '[?metadata.latitude != null].{RegionName:name,Longitude:metadata.longitude,Latitude:metadata.latitude}' > azure-regions2.json
#For the Carbon Aware SDK, use to match current format
az account list-locations --query '[?metadata.latitude != null].{Name:name,Longitude:metadata.longitude,Latitude:metadata.latitude}' | jq 'reduce .[] as $item ({}; .[$item.Name] = $item)' > azure-regions2.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment