Experience with WVD and Packer
For many of us working on Cloud, buzz words like agility, time to market are often bandied around loosely. While we see these key factors driving cloud growth on a daily basis, the actual impact on customers might be less remarkable.
Yet we reckon that agility is probably the most coveted ability in these Covid-19 days. At a time where global government rules are changing on a daily, and at times hourly basis, staying at home while staying the course on productivity became an overnight challenge.
While Singapore have been lauded for the country’s measured response on Covid-19 since January, the second wave of Covid-19 eventually forced the country into a circuit breaker starting from the 7th of April.
It was a jolt to the system. Everyone, sans the most essential of workers were now finding themselves having to work from home for a period of 1 month. The team at Microsoft sprung into action, working immediately with our customers driving POCs and Pilots of Windows Virtual Desktops (WVD).
It was an immense, but ultimately uplifting experience for both the team and our customers. At the same time, the few of us most heavily involved in WVD, namely myself, Jenzus Hsu and David Choo, all agreed that we had significant learnings during these times.
One of these learnings, is the fact that we haven’t been able to provide a one-click deployment that is good enough for a typical office worker, now required to work from home. Spending several hours braining storming with the team, we believe the idea of establishing a multi-session ready WVD image that includes generic tools, FSLogix and add-on monitoring
WVD Custom Image
There are varied options in the implementation of custom image. For example, we can create the master image locally and upload to storage account in Azure or the shared image gallery in Azure etc.
The way we are implementing here however, is to utilize Packer in the creation of the image with the configuration before the provisioning of Windows Virtual Desktop Services.
To understand further, we must first understand how we can construct the template used to build the custom Golden Image with the configuration of the Multi-Session Virtual Machine. For a comprehensive understanding on Packer, you can read it here to better understand how we can configure the build for Azure.
By following the steps listed in the URL, we created the service principal and assign the appropriate role to the service principal in order to access the resource group.
To create and successfully provision for Windows OS image, the following snippet is important for the communication using WinRM.
"communicator": "winrm",
"winrm_use_ssl": true,
"winrm_insecure": true,
"winrm_timeout": "5m",
"winrm_username": "packer",
You can also specify to deploy the image into different ways like Storage Account using VHD, or you can directly publish to Azure Shared Image Gallery which we am using in this example:
"shared_image_gallery_destination": {
"resource_group": "<rgname>",
"gallery_name": "<galleryname>",
"image_name": "<imagename>",
"image_version": "0.0.1",
"replication_regions": ["Southeast Asia"]
},
In this example, I am using a pre-installed image, non-default marketplace image that includes the following applications:
- Edge
- FSLogix
- Monitoring Agent
- O365
- Teams
If you are attempting to do the same, you can customize the template and add in the custom managed image location.
"managed_image_name": "<customimagename>",
"managed_image_resource_group_name": "<customerimagerg>"
After all the customization of the template is done like the following, you can start using the following command to build the image and publish to Azure Shared Image Gallery.
From the above sample, we included the provisioners script to run powershell inline during the provisioning of the image. This is to configure the parameters to pass in for the modification of the image and the benefit was that the IT Admin do not have to create multiple VM used for the imaging. You can achieve this by different ways as well.
With the above sample packer template, you can now run the packer validate and packer build in your local machine.
./packer build windows.json
The output will be generating the image and publish to Azure Shared Image Gallery.
After the image has been created, you can start provisioning WVD using the custom image. I am using this template for the WVD provisioning.
When the provisioning of WVD is done, you can assign the user to the Desktop Application Group.
Add-RdsAppgroupUser -TenantName <tenantname> -HostPoolName <hostpoolname> -AppGroupName “Desktop Application Group” -UserPrincipalName “<user>“
Finally, after this is completed, you can sign in to WVD using the WVD Web Client. Crossing fingers, you will be able to see the install applications and FSLogix being configured accordingly.
We understand that these are challenging times for everyone. Together with the team, we hope our sharing and learnings will be able to help you and your colleagues better navigate these stay-at-home orders.
Thanks for reading, and we welcome feedbacks and ideas. Cheers.
“PS: As we are just a bunch of folks seeking to make it easier for everyone to get productive faster, the writings are solely our own views and do not express the views or opinions of our employer”