Azure Virtual Desktop (AVD) - Image Update and Deployment
Notes:
- Windows 10 only allows you to run Sysprep 8 times. A snapshot of the VM disk was created before Sysprep was ran. The snapshot will be used to recreate the VM and update the image.
- You can either update your current VM’s manually or deploy new VM’s with your updated golden image.
Quick Step List
- Create VM From Snapshot
- Update VM
- Create Snapshot of VM Disk
- Sysprep VM
- Update VM Custom Image
- Add new VM(s) to Azure Virtual Desktop Host Pool from the new image
- Drain users off old VM’s
Create VM From Snapshot
- Log into the Azure Portal
- In the top Search bar type ‘disks’ and then click it
- Click the + Add button to add a new disk
- Complete the following sections
- Resource group: EnterName-RG
- Disk name: ServerName_OsDisk
- Source type: Snapshot
- Source snapshot: Select the snapshot created from your Azure Virtual Desktop VM
- Size: Change size to P10 128 GiB (Or whatever size the snapshot disk was)
- Click Review + create button then Create
- Once completed click the Go to resource button (Or go click on the new disk that was created under Disks)
- Click the button + Create VM
- Set the following:
- VM name: ServerName
- Size: Anything since its just updating the image
- Public inbound ports: None
- License type: Windows client
- Check box: I confirm I have an eligible Windows 10 license with multi-tenant hosting rights
- Click Next: Disks (Nothing needs to be changed here)
- Click Next: Networking
- Virtual Network: Vnet for the VM
- Subnet: Subnet for the VM
- Public IP: None
- Click Next: Management
- Monitoring: Disable
- Click Review + Create and then Create
Update VM
- RDP to the VM and make updates
Create Snapshot of VM Disk
- Power off and deallocate the VM
- Click on the VM in the Azure Portal
- Click Disks
- Click on the disk ServerName_OsDisk
- Click the + Create snapshot button
- Set the following:
- Name: WVD-Win10MS-Year-Month-Day-BeforeSysprep
- Storage type: Standard HDD
- Click Review + create button then Create
Sysprep VM
- Power on the VM and RDP to it
- Go to C:\Windows\System32\Sysprep and run sysprep.exe
- Select the settings shown in the image and click OK
Update VM Custom Image
- After the Virtual Machine has powered off, deallocate the Virtual Machine (Click on the VM in the Azure Portal and click Stop).
- After the Virtual Machine shows Stopped (deallocated), click on Capture
- Set the following:
- Check Box: Automatically delete this virtual machine after creating the image
- Target image gallery: Select the name of your Shared Image Gallery
- Target image definition: Enter the server name with -IMG
- Version number: Anything higher than 1.0.0
- Click Review + create and then Create
Add new VM(s) to Azure Virtual Desktop Host Pool from the new image
- In the Azure Portal search for your host pool and click the resource
- Click on Registration key
- Click Generate new key
- Enter a date and time for the key and click OK (Just long enough to add the new VM)
- Copy the key generated and close out the registration
- Click on Session hosts then click + Add button
- Next click the Next: Virtual Machines button
- Set the following:
- Virtual machine location: Select the VM location
- Image: ServerName-IMG (If this isn’t listed click See all images, My items, Shared Images)
- Number of VMs: Enter how many you want to create
- Virtual network: Select VM Vnet
- Subnet: Select VM subnet
- Specify domain or unit: Yes
- Domain to join: Enter your domain name (abc.local)
- AD domain join UPD: Enter a user that has rights to join the VM to the domain ([email protected])
- Password: Enter password for user above
- Username: Enter name for local admin user on VM
- Password: Enter password to use for the local admin user above and in confirm box
- Click the Review + create button and then Create
After the deployment is finished, the new servers are added to the Windows Virtual Desktop Host pool, created with the latest version of the custom image. You can drain the users off the old VM’s and test the new VM’s. If everything is working as expected you can then delete the old VM’s. You can also delete the old snapshot of the VM since you have a new one.
Drain users off old VM’s
- Under Pool name click on Session hosts
- Click on the old Azure Virtual Desktop VM you want to drain and set Drain mode to On
- Complete the same process on the next old Azure Virtual Desktop VM