Azure Monitor: change variable definitions in OOB dashboards to avoid dependency on sub level permission (#75765)

change variable definitions to avoid dependency on sub level permission
This commit is contained in:
jcolladokuri
2023-10-02 12:22:18 +01:00
committed by GitHub
parent 69ce0486a2
commit 1f266a051d
6 changed files with 211 additions and 87 deletions
@@ -8214,7 +8214,7 @@
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "$ds", "datasource": "$ds",
"definition": "ResourceGroups($sub)", "definition": "",
"description": null, "description": null,
"error": null, "error": null,
"hide": 0, "hide": 0,
@@ -8223,7 +8223,16 @@
"multi": false, "multi": false,
"name": "rg", "name": "rg",
"options": [], "options": [],
"query": "ResourceGroups($sub)", "query": {
"azureResourceGraph": {
"query": "resources\r\n| where [\"type\"] =~ \"Microsoft.Kusto/clusters\" \r\n| distinct resourceGroup"
},
"queryType": "Azure Resource Graph",
"refId": "A",
"subscriptions": [
"$sub"
]
},
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
@@ -8235,29 +8244,33 @@
"useTags": false "useTags": false
}, },
{ {
"allValue": null, "current": {},
"current": { "datasource": {
"selected": false, "type": "grafana-azure-monitor-datasource",
"text": "Microsoft.Kusto/clusters", "uid": "${ds}"
"value": "Microsoft.Kusto/clusters"
}, },
"description": null, "definition": "",
"error": null,
"hide": 0, "hide": 0,
"includeAll": false, "includeAll": false,
"label": "Name Space", "label": "Namespace",
"multi": false, "multi": false,
"name": "ns", "name": "ns",
"options": [ "options": [],
{ "query": {
"selected": true, "azureResourceGraph": {
"text": "Microsoft.Kusto/clusters", "query": "resources\r\n| where [\"type\"] =~ \"Microsoft.Kusto/clusters\" and resourceGroup =~ \"$rg\"\r\n| distinct [\"type\"]"
"value": "Microsoft.Kusto/clusters" },
} "queryType": "Azure Resource Graph",
], "refId": "A",
"query": "Microsoft.Kusto/clusters", "subscriptions": [
"$sub"
]
},
"refresh": 1,
"regex": "",
"skipUrlSync": false, "skipUrlSync": false,
"type": "custom" "sort": 5,
"type": "query"
}, },
{ {
"allValue": null, "allValue": null,
@@ -8272,7 +8285,13 @@
"multi": false, "multi": false,
"name": "resource", "name": "resource",
"options": [], "options": [],
"query": "ResourceNames($sub, $rg, $ns)", "query": {
"namespace": "$ns",
"queryType": "Azure Resource Names",
"refId": "A",
"resourceGroup": "$rg",
"subscription": "$sub"
},
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
@@ -2472,7 +2472,7 @@
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "${ds}", "datasource": "${ds}",
"definition": "ResourceGroups($sub)", "definition": "",
"description": null, "description": null,
"error": null, "error": null,
"hide": 0, "hide": 0,
@@ -2481,7 +2481,16 @@
"multi": false, "multi": false,
"name": "rg", "name": "rg",
"options": [], "options": [],
"query": "ResourceGroups($sub)", "query": {
"azureResourceGraph": {
"query": "resources\r\n| where [\"type\"] =~ \"Microsoft.Insights/components\"\r\n| distinct resourceGroup"
},
"queryType": "Azure Resource Graph",
"refId": "A",
"subscriptions": [
"$sub"
]
},
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
@@ -2492,7 +2501,7 @@
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "${ds}", "datasource": "${ds}",
"definition": "Namespaces($sub, $rg)", "definition": "",
"description": null, "description": null,
"error": null, "error": null,
"hide": 2, "hide": 2,
@@ -2501,9 +2510,18 @@
"multi": false, "multi": false,
"name": "ns", "name": "ns",
"options": [], "options": [],
"query": "Namespaces($sub, $rg)", "query": {
"azureResourceGraph": {
"query": "resources\r\n| where [\"type\"] =~ \"Microsoft.Insights/components\" and resourceGroup =~ \"$rg\"\r\n| distinct [\"type\"]"
},
"queryType": "Azure Resource Graph",
"refId": "A",
"subscriptions": [
"$sub"
]
},
"refresh": 1, "refresh": 1,
"regex": "([mM](icrosoft)\\.[iI](nsights)/(components))", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
"sort": 5, "sort": 5,
"type": "query" "type": "query"
@@ -2512,7 +2530,7 @@
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "${ds}", "datasource": "${ds}",
"definition": "ResourceNames($sub, $rg, $ns)", "definition": "",
"description": null, "description": null,
"error": null, "error": null,
"hide": 0, "hide": 0,
@@ -2521,7 +2539,13 @@
"multi": false, "multi": false,
"name": "res", "name": "res",
"options": [], "options": [],
"query": "ResourceNames($sub, $rg, $ns)", "query": {
"namespace": "$ns",
"queryType": "Azure Resource Names",
"refId": "A",
"resourceGroup": "$rg",
"subscription": "$sub"
},
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
@@ -791,14 +791,14 @@
"name": "rg", "name": "rg",
"options": [], "options": [],
"query": { "query": {
"grafanaTemplateVariableFn": { "azureResourceGraph": {
"kind": "ResourceGroupsQuery", "query": "resources\r\n| where [\"type\"] =~ \"Microsoft.Insights/components\"\r\n| distinct resourceGroup"
"rawQuery": "ResourceGroups($sub)",
"subscription": "$sub"
}, },
"queryType": "Grafana Template Variable Function", "queryType": "Azure Resource Graph",
"refId": "A", "refId": "A",
"subscription": "" "subscriptions": [
"$sub"
]
}, },
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
@@ -820,18 +820,17 @@
"name": "ns", "name": "ns",
"options": [], "options": [],
"query": { "query": {
"grafanaTemplateVariableFn": { "azureResourceGraph": {
"kind": "MetricNamespaceQuery", "query": "resources\r\n| where [\"type\"] =~ \"Microsoft.Insights/components\" and resourceGroup =~ \"$rg\"\r\n| distinct [\"type\"]"
"rawQuery": "Namespaces($sub, $rg)",
"resourceGroup": "$rg",
"subscription": "$sub"
}, },
"queryType": "Grafana Template Variable Function", "queryType": "Azure Resource Graph",
"refId": "A", "refId": "A",
"subscription": "" "subscriptions": [
"$sub"
]
}, },
"refresh": 1, "refresh": 1,
"regex": "([mM](icrosoft)\\.[iI](nsights)/(components))", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
"sort": 5, "sort": 5,
"type": "query" "type": "query"
@@ -850,16 +849,11 @@
"name": "res", "name": "res",
"options": [], "options": [],
"query": { "query": {
"grafanaTemplateVariableFn": { "namespace": "$ns",
"kind": "ResourceNamesQuery", "queryType": "Azure Resource Names",
"metricDefinition": "$ns",
"rawQuery": "ResourceNames($sub, $rg, $ns)",
"resourceGroup": "$rg",
"subscription": "$sub"
},
"queryType": "Grafana Template Variable Function",
"refId": "A", "refId": "A",
"subscription": "" "resourceGroup": "$rg",
"subscription": "$sub"
}, },
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
@@ -4921,7 +4921,7 @@
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "$ds", "datasource": "$ds",
"definition": "ResourceGroups($sub)", "definition": "",
"description": null, "description": null,
"error": null, "error": null,
"hide": 0, "hide": 0,
@@ -4930,7 +4930,16 @@
"multi": false, "multi": false,
"name": "rg", "name": "rg",
"options": [], "options": [],
"query": "ResourceGroups($sub)", "query": {
"azureResourceGraph": {
"query": "resources\r\n| where [\"type\"] =~ \"Microsoft.DocumentDb/databaseAccounts\"\r\n| distinct resourceGroup"
},
"queryType": "Azure Resource Graph",
"refId": "A",
"subscriptions": [
"$sub"
]
},
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
@@ -4942,35 +4951,39 @@
"useTags": false "useTags": false
}, },
{ {
"allValue": null, "current": {},
"current": { "datasource": {
"selected": false, "type": "grafana-azure-monitor-datasource",
"text": "Microsoft.DocumentDb/databaseAccounts", "uid": "${ds}"
"value": "Microsoft.DocumentDb/databaseAccounts"
}, },
"description": null, "definition": "",
"error": null,
"hide": 0, "hide": 0,
"includeAll": false, "includeAll": false,
"label": "Name Space", "label": "Namespace",
"multi": false, "multi": false,
"name": "ns", "name": "ns",
"options": [ "options": [],
{ "query": {
"selected": true, "azureResourceGraph": {
"text": "Microsoft.DocumentDb/databaseAccounts", "query": "resources\r\n| where [\"type\"] =~ \"Microsoft.DocumentDb/databaseAccounts\"\r\n| distinct [\"type\"]"
"value": "Microsoft.DocumentDb/databaseAccounts" },
} "queryType": "Azure Resource Graph",
], "refId": "A",
"query": "Microsoft.DocumentDb/databaseAccounts", "subscriptions": [
"$sub"
]
},
"refresh": 1,
"regex": "",
"skipUrlSync": false, "skipUrlSync": false,
"type": "custom" "sort": 5,
"type": "query"
}, },
{ {
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "$ds", "datasource": "$ds",
"definition": "ResourceNames($sub, $rg, $ns)", "definition": "",
"description": null, "description": null,
"error": null, "error": null,
"hide": 0, "hide": 0,
@@ -4979,7 +4992,13 @@
"multi": false, "multi": false,
"name": "resource", "name": "resource",
"options": [], "options": [],
"query": "ResourceNames($sub, $rg, $ns)", "query": {
"namespace": "$ns",
"queryType": "Azure Resource Names",
"refId": "A",
"resourceGroup": "$rg",
"subscription": "$sub"
},
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
@@ -2589,7 +2589,7 @@
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "$ds", "datasource": "$ds",
"definition": "ResourceGroups($sub)", "definition": "",
"description": null, "description": null,
"error": null, "error": null,
"hide": 0, "hide": 0,
@@ -2598,7 +2598,16 @@
"multi": false, "multi": false,
"name": "rg", "name": "rg",
"options": [], "options": [],
"query": "ResourceGroups($sub)", "query": {
"azureResourceGraph": {
"query": "resources\r\n| where [\"type\"] =~ \"Microsoft.KeyVault/vaults\"\r\n| distinct resourceGroup"
},
"queryType": "Azure Resource Graph",
"refId": "A",
"subscriptions": [
"$sub"
]
},
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
@@ -2610,20 +2619,39 @@
"useTags": false "useTags": false
}, },
{ {
"description": null, "current": {},
"error": null, "datasource": {
"type": "grafana-azure-monitor-datasource",
"uid": "${ds}"
},
"definition": "",
"hide": 2, "hide": 2,
"includeAll": false,
"label": "Namespace", "label": "Namespace",
"multi": false,
"name": "ns", "name": "ns",
"query": "Microsoft.KeyVault/vaults", "options": [],
"query": {
"azureResourceGraph": {
"query": "resources\r\n| where [\"type\"] =~ \"Microsoft.KeyVault/vaults\"\r\n| distinct [\"type\"]"
},
"queryType": "Azure Resource Graph",
"refId": "A",
"subscriptions": [
"$sub"
]
},
"refresh": 1,
"regex": "",
"skipUrlSync": false, "skipUrlSync": false,
"type": "constant" "sort": 5,
"type": "query"
}, },
{ {
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "$ds", "datasource": "$ds",
"definition": "ResourceNames($sub, $rg, $ns)", "definition": "",
"description": null, "description": null,
"error": null, "error": null,
"hide": 0, "hide": 0,
@@ -2632,7 +2660,13 @@
"multi": false, "multi": false,
"name": "resource", "name": "resource",
"options": [], "options": [],
"query": "ResourceNames($sub, $rg, $ns)", "query": {
"namespace": "$ns",
"queryType": "Azure Resource Names",
"refId": "A",
"resourceGroup": "$rg",
"subscription": "$sub"
},
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
@@ -6358,20 +6358,39 @@
"useTags": false "useTags": false
}, },
{ {
"description": null, "current": {},
"error": null, "datasource": {
"type": "grafana-azure-monitor-datasource",
"uid": "${ds}"
},
"definition": "",
"hide": 2, "hide": 2,
"includeAll": false,
"label": "Namespace", "label": "Namespace",
"multi": false,
"name": "ns", "name": "ns",
"query": "Microsoft.Storage/storageAccounts", "options": [],
"query": {
"azureResourceGraph": {
"query": "resources\r\n| where [\"type\"] =~ \"Microsoft.Storage/storageAccounts\"\r\n| distinct [\"type\"]"
},
"queryType": "Azure Resource Graph",
"refId": "A",
"subscriptions": [
"$sub"
]
},
"refresh": 1,
"regex": "",
"skipUrlSync": false, "skipUrlSync": false,
"type": "constant" "sort": 5,
"type": "query"
}, },
{ {
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "$ds", "datasource": "$ds",
"definition": "ResourceGroups($sub)", "definition": "",
"description": null, "description": null,
"error": null, "error": null,
"hide": 0, "hide": 0,
@@ -6380,7 +6399,16 @@
"multi": false, "multi": false,
"name": "rg", "name": "rg",
"options": [], "options": [],
"query": "ResourceGroups($sub)", "query": {
"azureResourceGraph": {
"query": "resources\r\n| where [\"type\"] =~ \"Microsoft.Storage/storageAccounts\"\r\n| distinct resourceGroup"
},
"queryType": "Azure Resource Graph",
"refId": "A",
"subscriptions": [
"$sub"
]
},
"refresh": 2, "refresh": 2,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,
@@ -6395,7 +6423,7 @@
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "$ds", "datasource": "$ds",
"definition": "ResourceNames($sub, $rg, $ns)", "definition": "",
"description": null, "description": null,
"error": null, "error": null,
"hide": 0, "hide": 0,
@@ -6404,7 +6432,13 @@
"multi": false, "multi": false,
"name": "resource", "name": "resource",
"options": [], "options": [],
"query": "ResourceNames($sub, $rg, $ns)", "query": {
"namespace": "$ns",
"queryType": "Azure Resource Names",
"refId": "A",
"resourceGroup": "$rg",
"subscription": "$sub"
},
"refresh": 2, "refresh": 2,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,