Grafana dashboard: Azure Windows Virtual Desktop Overview
Description: A sample dashboard that pulls in multiple data sources from Azure that all relate to Windows Virtual Desktop Instances.

This is a work in progress dashboard created for monitoring the Azure Windows Virtual Desktop service. It is meant to collect data from Azure Monitor, Azure Log Analytics, and influxDB. It works best if you are deploying your WVD Instances in a Scale Set.  

**Required Setup**
- Grafana deployed with a functional connection to Azure Monitor and Azure Log Analytics data sources. 
- InfluxDB (for storing session count)
- [Diag Data](https://docs.microsoft.com/en-us/azure/virtual-desktop/diagnostics-log-analytics) Export setup for Azure WVD Service

**Features:**

- Table log of active users in the time period specified. This is based on Log Analytic quereies. 
- Connection count per host pool based on Log Analytics generated by the WVD Service.
- Current active user count by host pool (Generated by Powershell script below)
  - https://github.com/nshores/azure_wvd_monitor/blob/master/rds_session_monitor.ps1
  - This should be run as a Azure Automation job in a playbook. 
- Template Panels that pull all currently available Azure Monitor statistics for the selected scale set.

**WIP Features:**
- Modifying rds_session_monitor script to pull in more stats about current sessions, and creating associated panels.
- Creating panel to show offline vs online instances in current scale set.

{
  "__inputs": [
    {
      "name": "DS_INFLUXDB",
      "label": "InfluxDB",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    },
    {
      "name": "DS_AZURE_MONITOR",
      "label": "Azure Monitor",
      "description": "",
      "type": "datasource",
      "pluginId": "grafana-azure-monitor-datasource",
      "pluginName": "Azure Monitor"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "6.2.5"
    },
    {
      "type": "datasource",
      "id": "grafana-azure-monitor-datasource",
      "name": "Azure Monitor",
      "version": "0.3.0"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 12636,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1594679294306,
  "links": [],
  "panels": [
    {
      "columns": [],
      "fontSize": "100%",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 86,
      "links": [],
      "options": {},
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": 0,
        "desc": true
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "TimeGenerated",
          "type": "date"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Metric",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "",
          "colorMode": "cell",
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Value",
          "thresholds": [
            "1"
          ],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "",
          "thresholds": [],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "appInsights": {
            "groupBy": "none",
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "spliton": "",
            "timeGrainType": "auto",
            "xaxis": "timestamp",
            "yaxis": ""
          },
          "azureLogAnalytics": {
            "query": "WVDActivityV1_CL \n| where TimeGenerated > ago(24h) \n| where Type_s == \"Connection\"\n| project TimeGenerated, UserName_s, SessionHostIPAddress_s, SessionHostName_s\n| where UserName_s != \"\"\n| order by TimeGenerated desc",
            "resultFormat": "table",
            "workspace": "00f8bf68-579c-44d1-9573-f555c502ec63"
          },
          "azureMonitor": {
            "dimensionFilter": "*",
            "metricDefinition": "select",
            "metricName": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "489d7f99-93e0-4bb0-9964-d29248fab15f"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "WVD User Log",
      "transform": "table",
      "type": "table"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "id": 46,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "null",
      "options": {},
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "Current Connections",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "measurement": "wvd_connections",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "pool-a"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Current Pool Connections",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": true,
      "dashLength": 10,
      "dashes": false,
      "description": "",
      "fill": 1,
      "gridPos": {
        "h": 9,
        "w": 24,
        "x": 0,
        "y": 8
      },
      "id": 2,
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": false,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null as zero",
      "options": {},
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "appInsights": {
            "groupBy": "none",
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "spliton": "",
            "timeGrainType": "auto",
            "xaxis": "timestamp",
            "yaxis": ""
          },
          "azureLogAnalytics": {
            "query": "let StartTime=ago(72h);\nlet StopTime=now();\nWVDActivityV1_CL\n| where  Type_s ==\"Connection\"\n| where SessionHostPoolName_s ==\"$scaleset\"\n| summarize Count=count() by Type_s, bin(TimeGenerated, 5min)\n| union (\n  range x from 1 to 1 step 1\n  | mv-expand TimeGenerated=range(StartTime, StopTime, 5m) to typeof(datetime)\n  | extend Count=0\n  )\n| summarize Count=sum(Count) by bin(TimeGenerated, 5m)  | where $__timeFilter()",
            "resultFormat": "time_series",
            "workspace": "00f8bf68-579c-44d1-9573-f555c502ec63"
          },
          "azureMonitor": {
            "dimensionFilter": "*",
            "metricDefinition": "select",
            "metricName": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "489d7f99-93e0-4bb0-9964-d29248fab15f"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "$scaleset Connection Count",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 17
      },
      "id": 6,
      "legend": {
        "avg": false,
        "current": false,
        "hideEmpty": true,
        "hideZero": true,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "maxPerRow": 2,
      "nullPointMode": "null",
      "options": {},
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "repeat": "metric",
      "repeatDirection": "h",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "appInsights": {
            "groupBy": "none",
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "spliton": "",
            "timeGrainType": "auto",
            "xaxis": "timestamp",
            "yaxis": ""
          },
          "azureLogAnalytics": {
            "query": "//change this example to create your own time series query\n<table name>                                                              //the table to query (e.g. Usage, Heartbeat, Perf)\n| where $__timeFilter(TimeGenerated)                                      //this is a macro used to show the full chart’s time range, choose the datetime column here\n| summarize count() by <group by column>, bin(TimeGenerated, $__interval) //change “group by column” to a column in your table, such as “Computer”. The $__interval macro is used to auto-select the time grain. Can also use 1h, 5m etc.\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "00f8bf68-579c-44d1-9573-f555c502ec63"
          },
          "azureMonitor": {
            "aggOptions": [
              "None",
              "Average",
              "Minimum",
              "Maximum",
              "Total",
              "Count"
            ],
            "aggregation": "Average",
            "dimension": "None",
            "dimensionFilter": "*",
            "dimensions": [
              {
                "text": "None",
                "value": "None"
              },
              {
                "text": "VMName",
                "value": "VMName"
              }
            ],
            "metricDefinition": "$ns",
            "metricName": "$metric",
            "resourceGroup": "$rg",
            "resourceName": "$scaleset",
            "timeGrain": "auto",
            "timeGrains": [
              {
                "text": "auto",
                "value": "auto"
              },
              {
                "text": "1 minute",
                "value": "PT1M"
              },
              {
                "text": "5 minutes",
                "value": "PT5M"
              },
              {
                "text": "15 minutes",
                "value": "PT15M"
              },
              {
                "text": "30 minutes",
                "value": "PT30M"
              },
              {
                "text": "1 hour",
                "value": "PT1H"
              },
              {
                "text": "6 hours",
                "value": "PT6H"
              },
              {
                "text": "12 hours",
                "value": "PT12H"
              },
              {
                "text": "1 day",
                "value": "P1D"
              }
            ]
          },
          "hide": false,
          "queryType": "Azure Monitor",
          "refId": "A",
          "subscription": "489d7f99-93e0-4bb0-9964-d29248fab15f"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "$scaleset $metric",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": false,
  "schemaVersion": 18,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_AZURE_MONITOR}",
        "definition": "ResourceGroups()",
        "hide": 0,
        "includeAll": false,
        "label": "rg",
        "multi": false,
        "name": "rg",
        "options": [],
        "query": "ResourceGroups()",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_AZURE_MONITOR}",
        "definition": "ResourceNames($rg, Microsoft.Compute/virtualMachineScaleSets)",
        "hide": 0,
        "includeAll": false,
        "label": "scaleset",
        "multi": false,
        "name": "scaleset",
        "options": [],
        "query": "ResourceNames($rg, Microsoft.Compute/virtualMachineScaleSets)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_AZURE_MONITOR}",
        "definition": "Namespaces($rg)",
        "hide": 0,
        "includeAll": false,
        "label": "ns",
        "multi": false,
        "name": "ns",
        "options": [],
        "query": "Namespaces($rg)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_AZURE_MONITOR}",
        "definition": "MetricNames($rg, Microsoft.Compute/virtualMachineScaleSets, $scaleset)",
        "hide": 0,
        "includeAll": true,
        "label": "metric",
        "multi": false,
        "name": "metric",
        "options": [],
        "query": "MetricNames($rg, Microsoft.Compute/virtualMachineScaleSets, $scaleset)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 2,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "Azure Windows Virtual Desktop Overview",
  "uid": "nocSfm8Wk",
  "version": 29,
  "description": "A sample dashboard that pulls in multiple data sources from Azure that all relate to Windows Virtual Desktop Instances."
}