Monitor Windows Virtual Desktop with Azure Monitor

Reading Time: 7 minutes

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.

How to set passwords to never expire in Azure

Reading Time: 3 minutes

In this blog post I will go through the process of enabling password expiration within the Microsoft 365 portal. I will also go through the default password options within Azure AD.

Note: this only applies if you’re utilising a Microsoft cloud only setup.
Also, at the time of writing this post, Azure AD does not allow configuring password expiration from the Azure portal. You must carry out this action via Powershell or from the 365 portal.

If you were not already aware, Microsoft recommend that the default password policy of password never expires is left in place unless absolutely necessary. According to Microsoft’s website research has found that when periodic password resets are enforced, passwords become less secure. Users tend to pick a weaker password and vary it slightly for each reset. If a user creates a strong password (long, complex and without any pragmatic words present) it should remain just as strong in the future as it is today. It is Microsoft’s official security position to not expire passwords periodically without a specific reason, and recommends that cloud-only tenants set the password policy to never expire. Your current policy is set to never let passwords expire.

Microsoft also highlight this within the Azure Portal secure score section as shown below

If there is requirement for you to set passwords to expire within the Cloud, let’s continue with the demo

  1. Login to portal.office.com
  2. Click Settings and Org settings

3. Click Security & privacy

4. Click Password and expiration policy

5. By default passwords are set to never expire. Click the option Set user passwords to expire after a number of days

6. Configure settings as required, or leave the defaults and click save

Moving on, let’s take a look at the default Azure password configuration

1) Click the link to launch the Azure Active Directory admin center

2) Click Azure Active Directory

3) Click Security from the left pane

4) Click Authentication Methods

5) Click Password protection

6) and here are the default settings

The audit option applies to the custom list of banned passwords. If set to Enforce, users will be prevented from setting banned passwords and the attempt will be blocked. If set to Audit, the attempt will only be logged.

Create and Optimise a Windows Virtual Desktop image

Reading Time: 7 minutes

In a previous post I created and deployed two Windows Virtual Desktop session hosts using a Windows 10 image (without 365 Apps) from the Azure market place. I manually installed the FSLogix app on both session hosts, configured Azure File shares for my profiles location and configured FSLogix application masking. The purpose of going through the process was to demonstrate how to setup a basic Windows Virtual Desktop solution within Azure.

In this blog post I will go through the process of building a Windows 10 image with 365 Apps included, install a few apps such as Google Chrome, Firefox, Adobe Reader and Notepad ++. I will then optimise the image as per Microsoft best practice. Let’s get started.

You can follow my Windows Virtual Desktop journey by visiting the blog posts I created previously.

1. Deploying Windows Virtual Desktop (WVD) in Microsoft Azure
2. Windows Virtual Desktop – Pooled vs Personal Desktops
3. Windows Virtual Desktop Application Group Creation
4. How to install and configure Windows Virtual Desktop Client
5. Configure FSLogix group policy and install FSLogix app
6. Use Azure Files for FSLogix user profile data with Window Virtual Desktop
7. Backup Azure Files Share
8. FSLogix application masking in Windows Virtual Desktop

  1. Login to the Azure portal portal.azure.com
  2. Build a new Windows 10 virtual machine

    > Click Virtual Machines
    > Click Add
    > Create a temp resource group (This resource group will be deleted later)
    > Select the Windows 10 Multi Session image. At the time of writing this blog post the latest version was Windows 10 Enterprise multi-session, Version 2004 + Microsoft 365 Apps
    > Select your VM size
    > Set a local admin username and password
    > This is a temporary setup in a lab environment – I’ll be connecting to this VM externally via RDP to allow me to configure further settings. Avoid allowing RDP externally.
    > Confirm your license status and click when ready
    > Click next and review disk setup
    > Click next to move on to networking and select your VNET and subnet
    > Click next to move onto management (No boot diagnostics or auto shutdown as the VM will be deleted later as part of the capture process)
    > Click review+create and then click create when validation passes

  3. We now have a Windows 10 VM ready. Let’s login to the newly built VM

4. Because we selected the image with 365 apps, the apps are pre-installed

Check that the VM is up to date with the latest windows updates

5. Next, install the FSLogix app available at: https://docs.microsoft.com/en-us/fslogix/install-ht


6. For the purpose of this demo, I will install some free software.

– Firefox
– Notepad ++
– Google Chrome
– Adobe Reader


7. Next we optimise the Windows 10 VM to remove services/apps which are not required for a WVD image. Microsoft’s recommended optimiser tool is Virtual Desktop Optimization Tool. The tool is based on optimising Windows 10 in a WVD environment. More information can be located at the following Microsoft Tech article: (Windows) Virtual Desktop Optimization Tool now available

Note: at the time of writing this blog post, the Virtual Desktop optimization was script based only

8. Let’s get started with applying the optimisations. Visit the following link from your newly created Windows 10 VM – https://github.com/The-Virtual-Desktop-Team/Virtual-Desktop-Optimization-Tool

9. Download the Virtual Desktop Optimization tool

10. Extract the folder to disk C (See example below)

11. Launch Powershell ISE from the start menu (Right click and run as administrator)

12. Click view and click show script pane if not already selected

13. Click file and browse to file Win10_VirtualDesktop_Optimize located at C:\OptimizationTool\Virtual-Desktop-Optimization-Tool-master, and click open

14. Scroll down and study the script

You can amend the configuration files and enable features which you don’t wish to disable.

In my case, I downloaded the Windows 10 2004 image so my configuration files are located at C:\OptimizationTool\Virtual-Desktop-Optimization-Tool-master\2004\ConfigurationFiles

15. For the purpose of this demo, I will be running the script as it comes (Note I typed 2004 as that’s the image version I am using)

Run the script when ready with a few additional switches

You will lose network connectivity for a couple of seconds but will auto connect to the session so not to worry.

16. Completed – total run time was 3 minutes and 50 seconds and a reboot is required. Reboot the VM

17. VM rebooted and we’re back in

Before optimising the VM, I took a snap of performance stats from the VM via task manager. Check out the stats below.

Before optimisation


After optimisation

18. Now, we sysprep the VM


Click the option to generalize and shutdown from the drop down

19. VM shutdown

20. We now capture the VM so it can be used as the base image when deploying our WVD host pool. Click the VM and click Capture

21. Input details (See example below)

Shared image gallery is a service that helps you build structure and organization around your managed images. You will be able to replicate your images globally, maintain versions, and more. Visit the following Microsoft link for more information Learn more

22. Review + Create

23. VM deleted but earlier in the post I deployed the original VM to a temp resource group. The VM has been deleted from the console but the resource group with some VM components remain.

We created a new resource group for our base image so this one is no longer required. Take care when deleting a resource group and ensure there are no other services you require making use of the resource group.


And we’re done

When creating your host pool, click the link to Browse all images and disks

Click My Items and select your VM

I won’t go through the process of creating a WVD Host Pool as I have covered this in previous posts. See links posted at the beginning of this post.

I have created a WVD Pool and selected my custom image

You’ll find that the source is no longer market place. See example below

Let’s login to the WVD web client

We’re in. Apps we installed earlier are visible

365 apps are also visible

The VM’s were automatically added to the domain and are visible within my selected OU in Active Directory

Add a domain to Microsoft 365 Step by Step

Reading Time: 6 minutes

In this blog post I will add and verify a domain in the Microsoft 365 admin portal. I will also setup an email address using the newly added domain via the Exchange admin center. Finally, I will test to ensure I can send and receive emails.

  1. Login to the Microsoft 365 Admin Portal at admin.microsoft.com (Login with Global Admin account)
  2. Click Show All

    Note: you could also add the domain by clicking Setup.

3. Click Settings

4. Click Domains

5. As you can see from the below screenshot, I have my default onmicrosoft.com domain displayed

6. Click Add Domain or purchase a new one by clicking Buy domain

7. Add a domain if you already own one and click use this domain when ready

8. I’ll be selecting the option to add a TXT record to my external domain DNS portal. Click continue

9. Microsoft provide a TXT record which I will need to add to my domain DNS portal. This process verifies that you own the domain you are trying to add to 365

10. I login to my domain portal at my domain registrars website, locate DNS and click to add a new TXT record.

11. I add the details and click Add Record

12. TXT record added successfully

13. Back to the 365 portal to verify the domain. If the domain does not verify, allow time for replication

14. The following appears after Microsoft have verified your domain. You may want to stop at this point as you may not want to configure email routing just yet without planning. I’ll explain further at step 15 below.

The text states:

Connect your domain to your Microsoft services so you can use email and instant messaging. There are a couple of options to consider, depending on how you’d like to manage domain name service (DNS) records for your domain ‎imranrashid.co.uk‎.

Add your own DNS records. We’ll provide a list of DNS records that you’ll need to add for your domain at your DNS host.

15. If you decide to cancel the setup after verification, you’ll find that the new domain is now available within Exchange Admin Center. Let’s take a look. Note that your domain has been verified so if you decide to cancel the wizard at this point. You can return and continue from where you left at a later time. Let’s login to Exchange Online and check the status of the new domain aswell as add a new email alias to my mailbox. No email routing has been configured at this point.

– Access Exchange Admin Center

– Click Mail flow

– Click accepted domains and you’ll find that the domain has been added as your default domain

-I won’t be able to receive email to this domain until I continue with configuring the required DNS/MX records but I am in a position to start configuring email addresses.

– Click on recipients

-In the example below, my mailbox is still set to the default onmicrosoft.com address

– Click the edit icon or double click the name

– Click email addresses, add your email address and save

– My email address has changed from the default onmicrosoft.com to my newly added domain.

16. I want to continue with setting up my records to allow me to send and receive emails to my new email address

You can continue with the domain setup at anytime. Note that if you’re using an external email filtering solution such as Mimecast the process is different so some planning is required before you decide to make this serious change of routing email into O365. Routing email changes should be completed at a suitable time to reduce impact to your users.

So i have acccessed the Microsoft 365 Portal, clicked settings, domains and clicked my domain which is currently displaying a status of Incomplete setup

17. Click Continue Setup

18. And we’re back at the setup screen we left earlier

19. Click more options and the below options appear

20. I will be selecting the default option Add your own DNS records, click continue

21. Microsoft have provided me with further records to add to my domain portal for imranrashid.co.uk

You’ll find a further option towards the bottom of the page as shown below. If you decide to click the options below, further DNS records will be provided for Skype For Business and Intune and Mobility Device Management for Micrsosoft 365

22. For the purpose of this demo, I will only be working with Exchange Online. Let’s add the MX, CNAME and TXT records to my domain portal for imranrashid.co.uk before we continue. Back to my domain portal to add the records.

23. Records added as specified by Microsoft, back to the portal.

Note: It may take some time for changes to replicate but in most cases the process does not take long. You will want to plan the replication time into your schedule as in some cases it can take up to 24 hours for DNS records to replicate.

24. Click continue

If there are issues, Microsoft will assist by providing recommendations on how to resolve your issues, for example, if you have typed or copied a record incorrectly, Microsoft will raise this on the next page.

25. Success, domain setup completed. I should now be able to send and receive emails.

26. Earlier in this blog post I assigned an email address to my mailbox via the Exchange Admin Center, so let’s test by logging into my mailbox and test email.

Send email outbound from [email protected]

Email received

Let’s reply to the email

Email received successfully

Stay tuned for further blog posts