Use Azure Monitor datasource - Resource Graph query in dashboard variables

Dennis 1 Reputation point
2022-06-01T10:41:45.377+00:00

Hi,

When using the Azure Monitor datasource in dashboard queries it allows me to run queries against Log, Resource Graph and Metrics. When I use the datasource in a dashboard variable query it only allows me to query Logs. Will it be possible to query the Resource Graph when populating a dashboard variable?

Thanks,
Dennis

Azure Managed Grafana
Azure Managed Grafana
An Azure service used to deploy Grafana dashboards for analytics and monitoring solutions.
106 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mitul Kacheria 1 Reputation point
    2022-06-03T15:22:39.12+00:00

    @Dennis , thanks for reaching out.

    One solution I can think of is to have an Azure Monitor datasource per tenant, have a datasource variable, and then use that datasource in the subscriptions variable. Below is some sample json. LMK how that works out.

    {
    "annotations": {},
    "editable": true,
    "fiscalYearStartMonth": 0,
    "graphTooltip": 0,
    "id": 8054,
    "iteration": 1654269532365,
    "links": [],
    "liveNow": false,
    "panels": [],
    "schemaVersion": 36,
    "style": "dark",
    "tags": [],
    "templating": {
    "list": [
    {
    "hide": 0,
    "includeAll": false,
    "multi": false,
    "name": "datasource",
    "options": [],
    "query": "grafana-azure-monitor-datasource",
    "queryValue": "",
    "refresh": 1,
    "regex": "",
    "skipUrlSync": false,
    "type": "datasource"
    },
    {
    "datasource": {
    "type": "grafana-azure-monitor-datasource",
    "uid": "${datasource}"
    },
    "definition": "",
    "hide": 0,
    "includeAll": false,
    "multi": false,
    "name": "subs",
    "options": [],
    "query": {
    "grafanaTemplateVariableFn": {
    "kind": "SubscriptionsQuery",
    "rawQuery": "Subscriptions()"
    },
    "queryType": "Grafana Template Variable Function",
    "refId": "A"
    },
    "refresh": 1,
    "regex": "",
    "skipUrlSync": false,
    "sort": 0,
    "type": "query"
    }
    ]
    },
    "time": {
    "from": "now-6h",
    "to": "now"
    },
    "timepicker": {},
    "timezone": "",
    "title": "Test for https://zcusa.951200.xyz/en-us/answers/questions/872975/index.html",
    "uid": "Emqalyrnz",
    "version": 1,
    "weekStart": ""
    }


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.