Hello all. I’m a long term .net developer.
I am building my first Datasource plugin for Grafana…so far I can get my plugin in and see the config and query editor.
Now exploring how to authenticate against the datasource with is using ADAL.
Normally I would just do this in .Net:
HttpClient client = HttpClientFactory.Create(new WebRequestHandler(),
new AuthenticationHandler(resource, tenant, aadFormat, appId, appKey));
client.BaseAddress = new Uri(address);
I need the equivalent in Angular so that I can make the same API calls.
I’ve seen the adal.js and adal-angular.js files from Microsoft, that I have seen integrated in a pure web app for angular. However, how would I use the same in a Plugin for Grafana?
Don’t know too much about ADAL but here is how I did it for the Azure Monitor data source plugin (no JavaScript involved):
This defines a route in the plugin.json, “azuremonitor”, when this route is activated then it gets a token using the tenantId, the client id and client secret from the data source config. Grafana will automatically fetch a new token when it expires. The user has to choose proxy mode in the data source config for this to work.
Grafana will strip off http://grafana.staged-by-discourse.com/api/datasources/proxy/72/azuremonitor and add in https://management.azure.com from the url field and send the request on to:
Then the {{.JsonData.tenant}} is not being resolved, it is taken as the literal string.
Is there a setting that needs to be enabled to allow this to resolve?
Everything works hardcoded so this is the last piece of the puzzle.
Hi @daniellee, i want to setup grafana azure monitor plugin on Azure Stack environemt, so i modify some code, but it does’t work, so how can i add azuerstack route?