

VirtualNetworkResourceGroupName = $virutalNetworkResoureGroupīecause of splatting parameters instead of using a parameter file you will need at least PowerShell module Az.Resources version 2.5.1. VmDiskType = $.StorageAccountTypeĮxistingSubnetName = $virtualNetworkSubnet VmNumberOfInstances = $sessionHostsNumber VmResourceGroup = ($resourceGroup).ToUpper() It is unnecessary filling a lot of parameters which are mostly known by the system, with all its consequences.ĪdministratorAccountUsername = $administratorAccountUsernameĪdministratorAccountPassword = (ConvertTo-SecureString $administratorAccountPassword -AsPlainText -Force) In most situations you will use a JSON template file in combination with a JSON parameter file. function create-wvdHostpoolToken($hostpoolName,$resourceGroup,$hostpoolSubscription) Virtual Machine Tags Network Interface TagsĪfter setting all the variables the template parameter will be created.

After running the function you will receive the whole registration info. To make code nice and clean I wrote a function for creating a WVD Hostpool registration key. You need a registration key before you are able to add sessionhosts to a hostpool. Import-module az.resources #At least version 2.5.1

There are some few requirements which are important.īefore continuing make sure have at least module version 2.5.1 of AZ.Resources in PowerShell. In this part we deploy new WVD sessionhosts and add it to an existing hostpool. The situation so far: we have created a new image, did a Sysprep, set the image as a version into the Shared Image Gallery.
