Skip to content

Instantly share code, notes, and snippets.

@ronaldbradford
Created February 9, 2026 22:12
Show Gist options
  • Select an option

  • Save ronaldbradford/425da25de795e09d6c0427161f080513 to your computer and use it in GitHub Desktop.

Select an option

Save ronaldbradford/425da25de795e09d6c0427161f080513 to your computer and use it in GitHub Desktop.
Azure Region Availability for Student Subscriptions
#!/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