Hero Banner

Azure Virtual Desktop (AVD)

Reply
bfrank
Moderator

How to change / alter a host pool's session host's vm size? (after it has been created)

Hi,

 

...You created a host pool in WVD. Set a default OS and a VM size. Created some session hosts. Fine...

But what if you now want to create new hosts with a different VM size? You can't as the size is fixed in the Azure Portal:

FixedVMSize.PNG 

 

This PShell-one-liner cancels this fixation and you are free to choose new when adding session hosts:

- thx to the community to pointing this out -

 

Update-AzWvdHostPool -Name myhostpool-1 -ResourceGroupName WVDRG -VMTemplate $null

 

Done!

(Note: It is maybe not whise to mix settings so that hosts run with different sizes or templates.)

 

 

Optional: If you need to set a new 'fixture' you can try the following:

 

#Get Hostpool to change
$resource = Get-AzResource -ResourceType 'Microsoft.DesktopVirtualization/hostpools' | Out-GridView -OutputMode Single -Title 'Select the HP to change'
$myHP = Get-AzWvdHostPool -Name $($resource.Name) -ResourceGroupName $($resource.ResourceGroupName) 

#modify settings using the correct sizings e.g.
$alternativevmtemplatesize = @{
    domain                = 'mywvd.net'
    galleryImageOffer     = 'Windows-10'
    galleryImagePublisher = 'MicrosoftWindowsDesktop'
    galleryImageSKU       = '20h2-evd'
    imageType             = 'Gallery'
    imageUri              = $null
    customImageId         = $null
    namePrefix            = 'HP1'
    osDiskType            = 'StandardSSD_LRS'
    useManagedDisks       = $true
    vmSize                = @{id='Standard_F2s_v2'; cores=2; ram=4}
    galleryItemId         = 'Microsoftwindowsdesktop.windows-1020h2-evd'
}

Update-AzWvdHostPool -Name $($myHP.Name) -VMTemplate $($alternativevmtemplatesize | ConvertTo-Json) -ResourceGroupName $($resource.ResourceGroupName)
#creating a new session host vm should now display the correct sizings.

 

 

result:

FixedVMSizeAfter.PNG

 

happy testing!

cheers,

Bernhard

6 REPLIES 6
JochenBerners
Level 2 Contributor

Hey Bernhard,

 

danke! Muss ich noch testen, bin aber guter Dinge, und Kunden bringt das auch definitiv nen Mehrwert!

 

VG

Jochen

bfrank
Moderator

😊

B.
admedcu
Visitor 1

Or just this command:

Update-AzWvdHostPool -Name myhostpool-1 ResourceGroupName WVDRG -VMTemplate $null
rvargas
Visitor 1

I'm trying to replicate it but is failing. Per official documentation the parameter should be still usable.

Link

 

Do you know if anything have change that is not enabling it to work?

 

Screenshot 2021-03-18 184616.png

 
 
 
 
njsee
Visitor 1

This is by far the easiest way.

Update-AzWvdHostPool -Name myhostpool-1 -ResourceGroupName WVDRG -VMTemplate $null

JonW
Level 4 Contributor

Good stuff thanks for posting!

 

Use this snippet to modify the existing template

 

ConvertFrom-Json $myhp.vmtemplate
$template = ConvertFrom-Json $myhp.vmtemplate
$template.vmSize = @{id='Standard_F2s_v2'; cores=2; ram=4}