With an Azure virtual machine you get host CPU, disk and up/down state of your VMs out of the box. Enabling additional monitoring capabilities provides insights into the performance and dependencies for your virtual machines.You will be billed based on the amount of data ingested and your data retention settings.
Note: It can take between 5-10 minutes to configure the virtual machine and the monitoring data to appear.
In this blog post I will be going through the process of monitoring my Windows Virtual Desktop session hosts via Azure monitor. I will configure an Azure Log Analytics Workspace, enable diagnostic settings for my host pool, application group and workspace. I will also enable diagnostic settings for Azure AD user sign ins. Finally, I will create a workbook to provide a visual display of stats from my WVD solution.
Let’s get started
Create an Azure Log Analytics Workspace
1. Login to the Azure Portal portal.azure.com
2. Locate and click Log Analytics Workspace
3. Click Add
4. Complete details for your new Log Analytics Workspace. For the purpose of this demo, I have inputted the details below.
5. Click next to move onto pricing tier. There is only one option available
6. Click review + create, allow validation to pass and click create
7. Next, let’s enable diagnostics starting within the Windows Virtual Desktop Host pool. Click Windows Virtual Desktop or locate via the search box
8. Click Host pools
9. Click your host pool
10. Click Diagnostic Settings
11. Click + Add diagnostic setting
12. Select the required log categories
13. Click the option to send to Log Analytics workspace and input a name. When done, click save. That’s the host pool diagnostics linked up to the new Log Analytics Workspace.
Note: If you receive the below error after clicking save, wait a couple of minutes and click save again. The resource does register after the error message appears. If you want to confirm microsoft.insights has registered:
– Click your subscription
– Click Resource Providers from the left pane
– Locate microsoft.insights
Failed to update diagnostics for ‘ ‘.{“code”:”SubscriptionNotRegistered”,”message”:”The subscription ‘0000000-0000-0000-0000-00000000000’ is not registered to use microsoft.insights.”}.
14. Repeat the steps (10 – 13) for Application Groups, Workspaces and also Azure AD Sign in Logs (Name accordingly)
Note the message about requiring Azure AD Premium when clicking user sign ins within Azure AD Diagnostic Settings. This refers to Azure Heat Map only that won’t work unless you have an AD P1 or P2 license.
15. Let’s enable the workspace agent on the session hosts. Locate Azure Monitor and click
16. Select Virtual Machines from the left pane
17. Click not monitored
18. Click enable against each session host you wish to deploy the agent
19. Click enable and perform the same step for the remaining session hosts you wish to install the agent
20. Select your workspace and click enable
The process may take up to 10 minutes
21. Once enabled, click your Log Analytics Workspace and click Advanced settings located in the left pane
22. Click Data and Windows Performance Counters
23. There were 36 performance and diagnostic counters to add at the time of writing this post. Travis Roberts has created a power shell script to automate the adding of these performance counters. The script is available to at performance and diagnostic data
You also have the option to add them manually (36 to add)
At the time of writing this blog post there was a limit of 20 performance counters which can be added at once through the Azure Portal. If adding manually, ensure you add the counters in batches to avoid the error below. Add batch one, save and then add batch two, or break down into smaller batches and save after each batch.
If adding manually, add the performance counter, click the blue + button and change the sample interval from 10 seconds to 60 seconds to avoid high costs
At the time of writing this blog post, the up to date performance counters are listed below (Visit Travis Roberts Git Hub page for the most up to date list)
‘Terminal Services Session()\% Processor Time’,
‘Terminal Services()\Active Sessions’,
‘Terminal Services()\Inactive Sessions’,
‘Terminal Services()\Total Sessions’,
‘LogicalDisk()\% Free Space’,
‘LogicalDisk()\Avg. Disk sec/Read’,
‘LogicalDisk()\Avg. Disk sec/Write’,
‘LogicalDisk()\Current Disk Queue Length’,
‘LogicalDisk()\Disk Reads/sec’,
‘LogicalDisk()\Disk Transfers/sec’,
‘LogicalDisk()\Disk Writes/sec’,
‘LogicalDisk()\Free Megabytes’,
‘Processor(_Total)\% Processor Time’,
‘Memory()\% Committed Bytes In Use’,
‘Network Adapter()\Bytes Received/sec’,
‘Network Adapter()\Bytes Sent/sec’,
‘Process()\% Processor Time’,
‘Process()\% User Time’,
‘Process()\IO Read Operations/sec’,
‘Process()\IO Write Operations/sec’,
‘Process()\Thread Count’,
‘Process()\Working Set’,
‘RemoteFX Graphics()\Average Encoding Time’,
‘RemoteFX Graphics()\Frames Skipped/Second – Insufficient Client Resources’, ‘RemoteFX Graphics()\Frames Skipped/Second – Insufficient Network Resources’,
‘RemoteFX Graphics()\Frames Skipped/Second – Insufficient Server Resources’, ‘RemoteFX Network()\Current TCP Bandwidth’,
‘RemoteFX Network()\Current TCP RTT’,
‘RemoteFX Network()\Current UDP Bandwidth’,
‘RemoteFX Network()\Current UDP RTT’,
‘PhysicalDisk()\Avg. Disk Bytes/Read’,
‘PhysicalDisk()\Avg. Disk Bytes/Write’,
‘PhysicalDisk()\Avg. Disk sec/Write’,
‘PhysicalDisk()\Avg. Disk sec/Read’,
‘PhysicalDisk()\Avg. Disk Bytes/Transfer’,
‘PhysicalDisk(*)\Avg. Disk sec/Transfer’
24. Performance counters added and interval set from 10 to 60 seconds
25. Click Save
26. Next, we’ll add the work book so we can view the data
27. Click Azure Monitor from within the portal
28. Click Workbooks from the left Pane
29. Click New
30. Click the icon </> as shown below
31. Copy and paste the code from the following WVD Community Git Hub page replacing the code currently displayed – Monitoring Workbook code
32. Click apply after replacing the code
33. Click to select your work analytics workspace if you see warnings such as the one below.
34. Click Done Editing
35. Click save and name your workbook accordingly
36. Done
Further sample queries can be located at the following Microsoft article created by Christiaan Brinkhoff – Proactively monitor ARM-based Windows Virtual Desktop with Azure Log Analytics and Azure Monitor. This is an excellent article and was a great help when creating this blog post. Also, thanks to Travis Roberts for creating the Powershell script to speed up the entering of performance counters. If you’re getting started with WVD, Travis has created a great WVD course available on the Udemy website called Zero to Hero with Windows Virtual Desktop.