How do I make auth request before API

I am trying to display information from Azure graph API to my grafana dashboard (Specifically security center security score so not Monitor or so).
The API call in itself and query works good I am able to display what I want. But only if I manually add the auth token to the header of the api request. (I am using JSON API as datasource).
But that is only valid for a short time until the token is invalid. How do I make an auth request before the JSON API call? I want to make auth request first to get a token then call the JSON API with that token… Is that possible in any way or am I forced to learn how to make a new plugin?


Did you check from Microsoft if you can set this specific auth token expiration to never ?

Good Luck


Thank you for your answer!
Microsoft token expire after 1h. You can get a refresh token with longer expiration… But that one is only used to call and refresh the 1h token. so still need to make calls to get new tokens.

I guess I have to create the plugin.

If anyone is looking for this here it what I am ending up doing (not fully finished though)
First you can add automated export of secutiy information from Azure Security Center to Azure Monitor (Security Score currently in preview).
Then you can add the Grafana Azure Monitor Plugin to get the score data from Azure Monitor to Grafana.

Hi @swippen if you are looking for azure resource graph, then I have a plugin available for this. GitHub - yesoreyeram/grafana-azure-datasource: Azure plus data source for Grafana to query azure resource graph. ( This doesn’t support azure graph yet. But can be easily extended to support more use cases )

Azure resource graph is now a part of Azure monitor plugin. Please try it and let us know if you face any issues.

This topic was automatically closed after 365 days. New replies are no longer allowed.