Azure Virtual Desktop is a cloud-based virtual desktop experience that allows you to connect to Azure Virtual Machines and virtualized applications. This desktops are organized in pools named Host Pools. Each pool has a set of virtual machines that serve as the desktops or sessions and wen you add a new VM, the default size is taken from the Host Pool info. How about to change the default size of the VM? In this article, we will use the PowerShell power to change that.
First, install the Azure PowerShell module using the
Install-Module command (the recommended option to install using the PowerShell 7.0 LTS version or higher):
The next step is to connect to the Azure using the
Before start to work with PowerShell, you need to select the Azure subscription you want to work with, using the
And then, we can start to define a few variables to get the necessary information before change the host pool VM size. The first one is the host pool name and then, the resource group name, required to indentify the host pool. With those values we can use the
Get-AzWvdHostPool to save the host pool object in a variable.
Get-AzWvdSessionHost command, we can get the session host objects (the VMs) and choose one to find the info related to the image definition.
With a one VM selected, we can access to the image reference id:
And save into a variable the VM prefix from a hostname:
Now we can extract the template used to create the hosts in the host pool from:
With all the info we can start to define the new VM template and after that, we can use the
Update-AzWvdHostPool command to change the default VM size for the Session Hosts into the pool. We need to change the
vmSize value to the new size we want:
The full script is here: