Windows Virtual Desktop (WVD) is a service that gives users easy and secure access to their virtualised desktops and remote apps. WVD has a concept of host pools, which is essentially a collection of Azure virtual machines that act as remote desktop session hosts that users connect to.
WVD is still in preview and has recently gone through some development referred to as Windows Virtual Desktop Spring 2020 Release. This release has introduced some much needed improvements with a WVD blade now in the Azure portal, AAD group integration, host pool registration tokens and much more.
With all the new changes to WVD, automating the deployment of host pools can be challenging, especially if you would like to automate the configuration of some of the optional features such as user profile containers.
Today we are going to run a deep dive and automate the WVD host pool deployment by setting up a pipeline in Azure DevOps.
You will need a few prerequisites before you will be able to continue.
- A key vault which holds the credentials used to domain join VMs.
- Log analytics workspace for WVD diagnostics logs
- (optional) A storage account joined to the domain with a file share configured to host user profile containers
My pipeline has been configured with 3 jobs.
The build job creates a temporary storage account and uploads the DSC files required to configure the host pool VMs.
The deploy job has numerous tasks;
- Creates WVD host pool and generates a temporary registration token
- Configures diagnostic logging to a log analytics workspace
- Obtains the password for the account to join VMs to domain from the key vault
- Conditionally deploys the ARM template to create VMs and register them to host pool using an Azure marketplace image or custom image
Here is where the magic begins!
The ARM template deployment not only deploys the Azure VMs and joins them to the domain. It runs a DSC configuration that installs the Windows Virtual Desktop Agents on each VM (yes, this was introduced in the spring release) and configures the agent with the registration token generated previously. This process allows your VMs to register and join the WVD host pool.
But wait, that’s not all!
Enter in the power of pipelines! If you would like to enable user profile containers you can simply set a variable to true and BAM! The DSC configuration will not only install the Windows Virtual Desktop agents but install the FSLogix software as well and configure it to store the user profiles in your domain joined storage account.
This gives you a much better alternative to creating an Azure VM image, install the FSLogix software, and configuring it with the storage account file share URI. Just imagine having to update an entire Azure VM image just to update the FSLogix file share URI, it is an admin overheard that can now be avoided.
In this job I run two steps once the pipeline completes;
- Remove temporary storage account containing DSC config files
- Remove host pool registration token I generated previously
Now that we have deployed a WVD host pool, we now have a bunch of VMs to manage, which can become cumbersome and an admin overhead, especially if we need to scale up those VMs.
One of the best reasons for moving to a pipeline deployment for WVD host pools, is that we can scale up the VMs at the click of a button!
So how do we do it? Easy by simply updating the value of a variable to the number of VMs we require.
Then we simply execute our pipeline again and it will scale accordingly.
An example of the ARM template and pipeline to automate the host pool deployment can be found here.