Prepare and customize a master VHD image
This article tells you how to prepare a master virtual hard disk (VHD) image for upload to Azure, including how to create virtual machines (VMs) and install software on them. These instructions are for a Azure Virtual Desktop-specific configuration that can be used with your organization's existing processes.
We recommend you use an image from the Azure Image Gallery. However, if you do need to use a customized image, make sure you don't already have the Azure Virtual Desktop Agent installed on your VM. Using a customized image with the Azure Virtual Desktop Agent can cause problems with the image, such as blocking registration and preventing user session connections.
Create a VM
Windows 10 Enterprise multi-session is available in the Azure Image Gallery. There are two options for customizing this image.
The second option is to create the image locally by downloading the image, provisioning a Hyper-V VM, and customizing it to suit your needs, which we cover in the following section.
Local image creation
Once you've downloaded the image to a local location, open Hyper-V Manager to create a VM with the VHD you copied. The following instructions are a simple version, but you can find more detailed instructions in Create a virtual machine in Hyper-V.
To create a VM with the copied VHD:
Open the New Virtual Machine Wizard.
On the Specify Generation page, select Generation 1.
Under Checkpoint Type, disable checkpoints by unchecking the check box.
You can also run the following cmdlet in PowerShell to disable checkpoints.
Set-VM -Name <VMNAME> -CheckpointType Disabled
If you create a VM from an existing VHD, it creates a dynamic disk by default. It can be changed to a fixed disk by selecting Edit Disk... as shown in the following image. For more detailed instructions, see Prepare a Windows VHD or VHDX to upload to Azure.
You can also run the following PowerShell cmdlet to change the disk to a fixed disk.
Convert-VHD –Path c:\test\MY-VM.vhdx –DestinationPath c:\test\MY-NEW-VM.vhd -VHDType Fixed
Software preparation and installation
This section covers how to prepare and install FSLogix and Windows Defender, as well as some basic configuration options for apps and your image's registry.
If you're installing Microsoft 365 Apps for enterprise and OneDrive on your VM, go to Install Office on a master VHD image and follow the instructions there to install the apps. After you're done, return to this article.
If your users need to access certain LOB applications, we recommend you install them after completing this section's instructions.
Set up user profile container (FSLogix)
To include the FSLogix container as part of the image, follow the instructions in Create a profile container for a host pool using a file share. You can test the functionality of the FSLogix container with this quickstart.
Configure Windows Defender
If Windows Defender is configured in the VM, make sure it's configured to not scan the entire contents of VHD and VHDX files during attachment.
This configuration only removes scanning of VHD and VHDX files during attachment, but won't affect real-time scanning.
For more detailed instructions for how to configure Windows Defender on Windows Server, see Configure Windows Defender Antivirus exclusions on Windows Server.
To learn more about how to configure Windows Defender to exclude certain files from scanning, see Configure and validate exclusions based on file extension and folder location.
Disable Automatic Updates
To disable Automatic Updates via local Group Policy:
- Open Local Group Policy Editor\Administrative Templates\Windows Components\Windows Update.
- Right-click Configure Automatic Update and set it to Disabled.
You can also run the following command on a command prompt to disable Automatic Updates.
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /t REG_DWORD /d 1 /f
Specify Start layout for Windows 10 PCs (optional)
Run this command to specify a Start layout for Windows 10 PCs.
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v SpecialRoamingOverrideAllowed /t REG_DWORD /d 1 /f
Set up time zone redirection
Time zone redirection can be enforced on Group Policy level since all VMs in a host pool are part of the same security group.
To redirect time zones:
- On the Active Directory server, open the Group Policy Management Console.
- Expand your domain and Group Policy Objects.
- Right-click the Group Policy Object that you created for the group policy settings and select Edit.
- In the Group Policy Management Editor, navigate to Computer Configuration > Policies > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Device and Resource Redirection.
- Enable the Allow time zone redirection setting.
You can also run this command on the master image to redirect time zones:
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fEnableTimeZoneRedirection /t REG_DWORD /d 1 /f
Disable Storage Sense
For Azure Virtual Desktop session host that use Windows 10 Enterprise or Windows 10 Enterprise multi-session, we recommend disabling Storage Sense. You can disable Storage Sense in the Settings menu under Storage, as shown in the following screenshot:
You can also change the setting with the registry by running the following command:
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" /v 01 /t REG_DWORD /d 0 /f
Include additional language support
This article doesn't cover how to configure language and regional support. For more information, see the following articles:
Other applications and registry configuration
This section covers application and operating system configuration. All configuration in this section is done through registry entries that can be executed by command-line and regedit tools.
You can implement best practices in configuration with either Group Policy Objects (GPOs) or registry imports. The administrator can choose either option based on their organization's requirements.
For feedback hub collection of telemetry data on Windows 10 Enterprise multi-session, run this command:
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 3 /f
Run the following command to fix Watson crashes:
remove CorporateWerServer* from Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting
Enter the following commands into the registry editor to fix 5k resolution support. You must run the commands before you can enable the side-by-side stack.
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v MaxMonitors /t REG_DWORD /d 4 /f reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v MaxXResolution /t REG_DWORD /d 5120 /f reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v MaxYResolution /t REG_DWORD /d 2880 /f reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\rdp-sxs" /v MaxMonitors /t REG_DWORD /d 4 /f reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\rdp-sxs" /v MaxXResolution /t REG_DWORD /d 5120 /f reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\rdp-sxs" /v MaxYResolution /t REG_DWORD /d 2880 /f
Prepare the image for upload to Azure
After you've finished configuration and installed all applications, follow the instructions in Prepare a Windows VHD or VHDX to upload to Azure to prepare the image.
After preparing the image for upload, make sure the VM remains in the off or deallocated state.
Upload master image to a storage account in Azure
This section only applies when the master image was created locally.
The following instructions will tell you how to upload your master image into an Azure storage account. If you don't already have an Azure storage account, follow the instructions in this article to create one.
Convert the VM image (VHD) to Fixed if you haven't already. If you don't convert the image to Fixed, you can't successfully create the image.
Next, go to the Azure portal in your browser and search for "Images." Your search should lead you to the Create image page, as shown in the following screenshot:
Once you've created the image, you should see a notification like the one in the following screenshot:
Now that you have an image, you can create or update host pools. To learn more about how to create and update host pools, see the following articles:
- Create a host pool with an Azure Resource Manager template
- Tutorial: Create a host pool with Azure Marketplace
- Create a host pool with PowerShell
- Create a profile container for a host pool using a file share
- Configure the Azure Virtual Desktop load-balancing method
If you encountered a connectivity problem after preparing or customizing your VHD image, check out the troubleshooting guide for help.