Azure Virtual Desktop (AVD) - Image Update and Deployment

Notes: 

  1. 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.
  2. 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

  1. Log into the Azure Portal
  2. In the top Search bar type ‘disks’ and then click it


  3. Click the + Add button to add a new disk


  4. Complete the following sections
    1. Resource group: EnterName-RG
    2. Disk name: ServerName_OsDisk
    3. Source type: Snapshot
    4. Source snapshot: Select the snapshot created from your Azure Virtual Desktop VM
    5. Size: Change size to P10 128 GiB (Or whatever size the snapshot disk was)


  5. Click Review + create button then Create
  6. Once completed click the Go to resource button (Or go click on the new disk that was created under Disks)
  7. Click the button + Create VM

     
  8. Set the following:
    1. VM name: ServerName
    2. Size: Anything since its just updating the image
    3. Public inbound ports: None
    4. License type: Windows client
    5. Check box: I confirm I have an eligible Windows 10 license with multi-tenant hosting rights
  9. Click Next: Disks (Nothing needs to be changed here)
  10. Click Next: Networking
    1. Virtual Network: Vnet for the VM
    2. Subnet: Subnet for the VM
    3. Public IP: None

  11. Click Next: Management
    1. Monitoring: Disable
  12. Click Review + Create and then Create

Update VM

  1. RDP to the VM and make updates 

Create Snapshot of VM Disk

  1. Power off and deallocate the VM
  2. Click on the VM in the Azure Portal
  3. Click Disks
  4. Click on the disk ServerName_OsDisk
  5. Click the + Create snapshot button


  6. Set the following:
    1. Name: WVD-Win10MS-Year-Month-Day-BeforeSysprep
    2. Storage type: Standard HDD


  7. Click Review + create button then Create  

Sysprep VM

  1. Power on the VM and RDP to it
  2. Go to C:\Windows\System32\Sysprep and run sysprep.exe
  3. Select the settings shown in the image and click OK

Update VM Custom Image

  1. After the Virtual Machine has powered off, deallocate the Virtual Machine (Click on the VM in the Azure Portal and click Stop). 
  2. After the Virtual Machine shows Stopped (deallocated), click on Capture


  3. Set the following:
    1. Check Box: Automatically delete this virtual machine after creating the image
    2. Target image gallery: Select the name of your Shared Image Gallery
    3. Target image definition: Enter the server name with -IMG
    4. Version number: Anything higher than 1.0.0


  4. Click Review + create and then Create 

Add new VM(s) to Azure Virtual Desktop Host Pool from the new image

  1. In the Azure Portal search for your host pool and click the resource

     
  2. Click on Registration key

     
  3. Click Generate new key
  4. Enter a date and time for the key and click OK (Just long enough to add the new VM)



  5. Copy the key generated and close out the registration
  6. Click on Session hosts then click + Add button



  7. Next click the Next: Virtual Machines button


      
  8. Set the following:
    1. Virtual machine location: Select the VM location
    2. Image: ServerName-IMG (If this isn’t listed click See all images, My items, Shared Images)
    3. Number of VMs: Enter how many you want to create
    4. Virtual network: Select VM Vnet
    5. Subnet: Select VM subnet
    6. Specify domain or unit: Yes
    7. Domain to join: Enter your domain name (abc.local)
    8. AD domain join UPD: Enter a user that has rights to join the VM to the domain (sysadmin@abc.local)
    9. Password: Enter password for user above
    10. Username: Enter name for local admin user on VM
    11. Password: Enter password to use for the local admin user above and in confirm box



  9. 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

  1. Under Pool name click on Session hosts
  2. Click on the old Azure Virtual Desktop VM you want to drain and set Drain mode to On


  3. Complete the same process on the next old Azure Virtual Desktop VM