Created
February 9, 2026 22:12
-
-
Save ronaldbradford/425da25de795e09d6c0427161f080513 to your computer and use it in GitHub Desktop.
Azure Region Availability for Student Subscriptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -o pipefail | |
| set -o errexit | |
| set -o nounset | |
| ################################################################################ | |
| # | |
| # A script to search for available regions in Azure for Students Subscription | |
| # | |
| # Original idea from Professor Jeffrey Kramer | |
| ################################################################################ | |
| error() { | |
| echo "ERROR: $*" | |
| exit 1 | |
| } | |
| [[ "$(uname)" != "Darwin" ]] && error "Only runs on MacOS" | |
| command -v az &> /dev/null || error "Azure CLI (az) is not installed, try 'brew install az'" | |
| command -v jq &> /dev/null || error "jq is not installed, try 'brew install jq'" | |
| [[ -z "${REGIONS:-}" ]] && REGIONS=$(az policy assignment list --query "[?name=='sys.regionrestriction'].parameters.listOfAllowedLocations.value" -o json | jq -r .[].[] | tr $'\n' ' ') | |
| SIZE=${SIZE:-Standard_D2s_v3} | |
| echo "Looking for availalibility of '${SIZE}' in regions: '${REGIONS}'" | |
| echo "NOTE: This can take several minutes to run" | |
| for REGION in ${REGIONS}; do | |
| RESULT=$(az vm list-skus --location "${REGION}" --size "${SIZE}" --query "[0].restrictions" -o tsv) | |
| if [[ -z "${RESULT}" ]]; then | |
| echo "${REGION}: ✓ Available (no restrictions)" | |
| else | |
| echo "${REGION}: ✗ Restricted - ${RESULT}" | |
| fi | |
| done | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment