description: Using template variables with Azure Monitor in Grafana
keywords:
- grafana
- microsoft
- azure
- monitor
- application
- insights
- log
- analytics
- templates
- variables
- queries
menuTitle: Template variables
title: Azure Monitor template variables
weight: 400
---
# Azure Monitor template variables
Instead of hard-coding details such as resource group or resource name values in metric queries, you can use variables.
This helps you create more interactive, dynamic, and reusable dashboards.
Grafana refers to such variables as template variables.
For an introduction to templating and template variables, refer to the [Templating]({{< relref "../../../dashboards/variables" >}}) and [Add and manage variables]({{< relref "../../../dashboards/variables/add-template-variables" >}}) documentation.
## Use query variables
You can specify these Azure Monitor data source queries in the Variable edit view's **Query Type** field.
It is possible to select multiple values for **Resource Groups** and **Resource Names** and use a single metrics query pointing to those values as long as they:
- Belong to the same subscription.
- Are in the same region.
- Are of the same type (namespace).
Also, note that if a template variable pointing to multiple resource groups or names is used in another template variable as a parameter (e.g. to retrieve metric names), only the first value will be used. This means that the combination of the first resource group and name selected should be valid.