Note to self: Management endpoint for Azure Gov Cloud


This is just a note for me and anyone else who may need this.

The Azure Management APIs are all documented to use management.azure.com as a base URL. When you need to access the same URLs over AzureUSGovernment cloud, the base URL changes to

management.usgovcloudapi.net. At least, that change happened for the CognitiveService which I had soft deleted, tried to purge, and had to resort to REST APIs because the gov cloud for CognitiveServices can lag public cloud by many months.

Anyhow, it took me about 30 minutes to find this magic URL, so I’m passing it along to you.

One other helper note: if you need the access token to execute some management APIs from Postman (or similar), you can get the authentication token after a call to az login by using this command:

az account get-access-token

Then, just paste the value from the accessToken field into the Authorization header as:

Bearer <contents of accessToken>

Example to generate the whole string and echo things out correctly via a bash shell:

access_token=$(az account get-access-token --query accessToken -o tsv) && echo "Bearer $access_token"