How to dynamically build parameters of the query

Hi,

i have the following query used to display a graph in a panel:

As the stages are separated into different subscriptions and all resources have the environment name as part of the resource name template we can currently not easily reuse the grafana dashboards we created.

So I thought about creating a new variable called environment containing one of the possible values (e.g. dev, int, prod) which then can be changed by the user depending on the environment. The problem here is that the names of the subscription, resource group and resource also contains the environment. Therefore I’d like to use something like example-${env}-aks in the query to make the dashboard more reusable. I also tried to create a variable (constant, query from Grafana and textbox) with this value but the variable won’t be replaced with the chosen value by Grafana.

Do you have an idea on how to solve this?

One option is to use the Azure Monitor template variables for Subscriptions, Resource Groups, Namespaces and Resources so users can choose these selectors on the dashboard and the panels automatically updates. You can see how these variables are used in Azure Monitor Storage Insights or Azure Monitor Application Insights dashboards.