Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Instead of hard-coding values for fields like resource group or resource name in your queries, you can use variables in their place to create more interactive, dynamic, and reusable dashboards.
Check out the Templating documentation for an introduction to the templating feature and the different
types of template variables.
The Azure Monitor data source provides the following queries you can specify in the Query field in the Variable edit view
Name
Description
Subscriptions()
Returns subscriptions.
ResourceGroups()
Returns resource groups.
ResourceGroups(subscriptionID)
Returns resource groups for a specified subscription.
Namespaces(aResourceGroup)
Returns namespaces for the default subscription and specified resource group.
Namespaces(subscriptionID, aResourceGroup)
Returns namespaces for the specified subscription and resource group.
workspace("$workspace").Perf | where ObjectName == "$object"| distinct CounterName
Returns a list of metric names from the Perf table
Example of a time series query using variables:
kusto
Perf
| where ObjectName == "$object" and CounterName == "$metric"
| where TimeGenerated >= $__timeFrom() and TimeGenerated <= $__timeTo()
| where $__contains(Computer, $computer)
| summarize avg(CounterValue) by bin(TimeGenerated, $__interval), Computer
| order by TimeGenerated asc