User Tools

Site Tools


Connect to Azure REST API

This uses so-called client credentials grant for accessing the API. There are also authorization via code to get the token mentioned below.

In your account open the azure shell. After connecting create the principal

az ad sp create-for-rbac --role Contributor --scope /subscriptions/<your subscription id>

Subscription id can be obtained from URL when you are logged in to or with this command

az account show --query id -o tsv

You should get the following similar info

  "appId": "257xxxxxxxxxxxxxxxxxxxxxx",
  "displayName": "azure-cli-2022-08-30-10-52-10",
  "password": "xxxxxxxxxxxxxxxxxxxxx",
  "tenant": "4aedxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

This data can now be used to get query the API but you still need the BearerToken which can be obtained via this script, which can be used in Postman as a “Pre-request Script”

You can also get the token via curl see this

Tested on

  • Microsoft Azure accessed on 2022-08-30

See also


wiki/connect_azure_rest_api.txt · Last modified: 2022/09/02 15:30 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki