Unable to configure a query to Azure Monitor/ Application Insights when defining variable

I’m trying to create a variable based on a query to Application Insights. The query works fine if used in a simple panel, but I’m not able to move it to a variable
The panel configuration has some additional config for Resource:

and I’m missing this config in Variables view:

I found some info, but it seems to apply only to Log Analytics, not Application Insights:
Azure Monitor template variables | Grafana Labs

Is it possible to make a variable based on a query to Application Insights?

1 Like

All resource logs including those from workspace-based Application Insights are available in Log Analytics workspaces. You can create template variables on any Logs query that returns in single list of values. Here is an example using the App Insights requests table on an LA workspace.


Tip: Verify the workspace where your App Insights data is stored to get the correct workspace name needed for the variable query. Note the difference in table name and the use of distinct to ensure a single list of values.

Thanks! Your solution seems fine for workspace-based Application Insights, whereas I’m using Classic Application Insights (not so future-proof). Sorry for not mentioning it earlier.

It’s not explicitly mentioned in the docs, but it seems that such queries for variables can only be used with workspace-based Application Insights.

Correct, as of Grafana 8.0, support for querying Application Insights classic has been deprecated in favor of querying through metrics or logs (workspace based). Application Insights deprecation | Grafana Labs