Skip to content

Instantly share code, notes, and snippets.

@omarmciver
Created November 9, 2022 18:59
Show Gist options
  • Save omarmciver/06c4dd83a14ce04e3c9b23c8be7aa14b to your computer and use it in GitHub Desktop.
Save omarmciver/06c4dd83a14ce04e3c9b23c8be7aa14b to your computer and use it in GitHub Desktop.
AZ API Calls
$ SUBSCRIPTION_ID=$(az account show --query id -o tsv)
$ az rest \
--url "https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourcegroups?api-version=2020-06-01 |
jq ".value | .[] | .name" -r
OR
$ curl -sL \
-H "authorization: bearer $(az account get-access-token --query accessToken -o tsv)" \
-H "contenttype: application/json" \
"https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourcegroups?api-version=2020-06-01" |
jq ".value | .[] | .name" -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment