In my previous blog I showed step-by-step how to create a custom Windows 10 multi-user image with Line Of Business (LOB) installed on it for use with Windows Virtual Desktop (WVD). Most of the time updates are needed after a few days or weeks, there are the Windows updates off course, but also the LOB application updates. Or perhaps new LOB applications needs to be added to the image. How do you update a Windows Virtual Desktop (Preview) Hostpool without recreating the (master) image from scratch? Or how do you make sure you have a fallback to a previous “version” of your master image in case something went wrong?
There are a few different ways to do this during the Windows Virtual Desktop Preview, and I want to show you my way.
Current Status of Master Image VM
Like in my previous blog described, I have created a new Windows 10 multi-user Virtual Machine. I have installed some Line Of Business (LOB) applications and did apply some optimizations. Then I turned of the VM and made a snapshot of OS Disk. Why I did that? I got two reasons for that;
- I run Sysprep before I deploy the WVD Hostpool, and after you run Sysprep you cannot connect to your VM in Azure anymore (at least I was not able to do so and could not find a good way to do so);
- I want to have the ability to fall back to a previous “version” of the OS Disk without the need to rebuild my Master Image in case of any problems.
So right after customizing the image, I turned off the VM and created the VHD Snapshot. Then I turned the Virtual Machine back on, Started Sysprep with the shutdown option and after that, I deployed a WVD Hostpool with it. Once again you can read/see all these steps in this previews blog.
In this blog
In this blog I will update my master image. I will install the Firefox browser and I will update the Windows Virtual Desktop Hostpool with this up-to-date master image. I will do this within the following steps;
- Restore a VHD snapshot
- Update the image with latest updates and LOB applications
- Create a new snapshot
- Prepare the image for deploying a WVD Hostpool
- Update the current WVD Hostpool
- Publish new LOB applications
- Test the results
In my current environment I have two Windows Virtual Desktop Hostpools up and running with this custom image. One for the Desktop, and one for the published applications. Firefox will be added in this environment during this step-by-step blog.
Step 1 : Restore a VHD Snapshot
Because we have used Sysprep in the current state of the Master Image we first need to promote a snapshot we have created earlier (see step 3 of this blog).
Make sure the WVD Master VM is Stopped (deallocated)
Open the Resource group of the WVD Master VM, and open the Storage account.
Open the Blobs blade and then go to vhds.
Select the image and click Break lease and then click OK
Make sure the Lease State is Broken and click View snapshots
Select the snapshot and click Promote snapshot
Go back to the vhd file and click Acquire lease
Make sure the Lease state is back to Leased again
Go to Virtual Machines and start the WVD Master VM
Step 2 : Update the image with latest updates and LOB applications
Connect to the Master VM.
Apply your updates. In my case I have installed the Firefox browser. After you’re done, shut down the Virtual Machine.
Step 3 : Create a new snapshot
The next step is to create a new snapshot.
Deallocate the VM after the Shutdown by clicking the Stop button
Navigate to Resource groups. Open the resource group of the Master Image VM and open the Storage Account.
Open the Blobs blade and then open vhds
Click Create snapshot
When clicking on View snapshots you can see that there are now two snapshots available to restore the master image.
Step 4 : Prepare the image for deploying a WVD Hostpool
Go to Virtual Machines and Start the WVD Master VM.
Once the VM is started, connect to it and run c:\Windows\System32\Sysprep\sysprep.exe. Make sure you select Enter System Out-of-Box Experience (OOBE) as System Cleanup Action. Enable/select Generalize and select Shutdown as Shutdown options. Click OK
Once the VM is Stopped, deallocate it via the Stop button.
Step 5 : Update the current WVD Hostpool
Now that you have a new updated image, you can create a new WVD hostpool with it or update an existing WVD hostpool. To update an existing WVD hostpool, you can use this “ARM Template for Windows Virtual Desktop Hostpool Deployment”. Before running this template we must first collect some information. First we need the URL of the Master VM OS Disk.
Navigate to Virtual Machines, open the WVD-Master VM and open the Disk page. Click the WVD-Master disk.
Copy the VHD URI to a Notepad or something else.
Navigate to Azure Active Directory > Properties and copy the Directory ID to Notepad (or something else).
Go to the “ARM Template for Windows Virtual Desktop Hostpool Deployment” template on GitHub and click Deploy to Azure. This template will remove the old Hostpool Sessionhosts and will create new ones within the same Hostpool so you do not have to publish all applications again and assign it the all the users.
Fill in the following (and leave the other settings empty or default) ;
Subscription : Select your Azure Subscription
Resource group : Select your current Resource group or create a new one (I had some problems when using an existing Resource group so I always create a new one)
Rdsh Image Source : CustomVHD
Vm Image Vhd Uri : Past your VHD URL we copied earlier
Rdsh Number Of Instances : Fill in the number of sessionhost that must be created (replaced)
Rdsh VM Disk Type : select the disk type you want to use
Fill in the following;
Rdsh VM Size : Fill in the Size of the Sessionhost VM’s
Domain To Join : Fill in your (internal) domain name
Existing Domain UPN : Fill in the UPN of the user that can join the VM’s to AD
Existing Domain Password : Fill in the password of the user
Existing Vnet Name : Fill in the name of your Azure Vnet
Existing Subnet Name : Fill in the name of your Azure Vnet Subnet
Virtual Network Resource Group Name : The name of the Resource group the Vnet is part of
Existing Tenant Name : Your WVD Tenant Name
Existing Hostpool Name : The name of the Hostpool you want to update
Fill in the following;
Tenant Admin Upn Or Application Id : Fill in the UPN of the user with Tenant Owner rights
Tenant Admin Password : Fill in the password of the user
Aad Tenant Id : Fill in your Azure Tenant ID we copied earlier
Action On Previous Virtual Machines : Delete or Allocate (wat you want)
User Notification Message : Fill in the number of minutes you want to give the current active users to logoff
Select I agree to the terms and conditions stated above and click Purchase
After a moment (can take up to 30 minutes in same cases) your deployment is complete.
At this moment the old VM’s are deleted (or allocated) and the new VM’s with the up-to-date image are up and running.
Step 6 : Publish new LOB applications
Now that the new image is live, I will publish Firefox as new application. I will do that via the WVD Management Tool.
I navigate to my Application Hostpool. I have created a Application group named Browsers. I will add Firefox to this group.
Open the group and click the + Publish Apps from the Start Menu
Select Firefox and click Publish
Step 7 : Test the results
Lets test the results by refreshing / updating the Remote Desktop Client.
And as you can see, Firefox is added to the list of published applications.