Skip to content

Integrate your applications via oAuth2

Azure Costs offers a simplified way to integrate your applications in Azure Costs. Here is how to integrate an application in Azure Costs, that you are developing . This might for example be your BI dashboard or some other enterprise application integration platform that consumes data Azure Costs provides.

Step 1: Create an application principal

Every application which shall be integrated in Azure Costs needs to be registered as a so called application principal within a team account. The technical reason for this is that the authorisation relies on the oauth2 client credentials flow.

app-registrationpng

The application principal can be used in the same way as an interactive user. This means it’s possible to assign specific permissions to the application principal. All features of the access rights and permissions system can be used out of the box for application principals as well.

There are no limitations, every enterprise subscription allows to create as many application principals as required. In case of exposing the client secret by accident please remove or reset the application registration to prevent unauthorized access to your spending data.

Step 2: Get an access token with the client credentials grant flow

Based on the client credentials grant flows it’s possible to get the access token which needs to be used to communicate with the Azure Costs API following the “Bearer” schema in the authorisation header. The Token can be issued with the following call:

curl -X POST -d “client_id=<<clientId>>&client_secret=<<clientSecret>>&grant_type=client_credentials” https://azure-costs.com/sts/issue/oauth/token

The generated access token is valid for 60 minutes and needs to be renewed after that time with the same request.

Step 3: Consume our APIs

The Azure Costs API is available via https://api.azure-costs.com and follows the REST paradigm. If you need more information please contact us, we will support you with your project.


Feedback and Knowledge Base