Jay
Jay

Reputation: 3

Powershell Script to deploy the ARM Template

Deploying the ARM Template using the Powershell, need to fetch the previous AVD Session host number from Azure Portal and from which we can pass the next incremental value in the ARM template by declaring a variable.

#Login-AzAccount
$vminitialnumber= Get-AzWvdSessionHost -HostPoolName infosyswvd -ResourceGroupName avd 
New-AzResourceGroupDeployment `
-ResourceGroupName AVD `
-TemplateFile 'D:\Updated-AVD\East US\Template.json' `
-TemplateParameterFile 'D:\Updated-AVD\East US\Parameters.json'

Upvotes: 0

Views: 1024

Answers (1)

Delliganesh Sevanesan
Delliganesh Sevanesan

Reputation: 4776

Please check the below workaround:

Install module

Install-Module Az.Avd
Import-Module Az.Avd

Fetch the Latest Session Host

Use the Get-AvdLatestSessionHost to get the Latest Session Host.

syntax
Get-AvdLatestSessionHost -HostpoolName <String> -ResourceGroupName <String> [-NumOnly] [<CommonParameters>]
  • NumOnly - Here you will set the Switch Parameter. You will get the next session host number. -InputObject - Here put the hostpool object.
Example to Get the Latest session Host of ADV
Get-AvdLatestSessionHost -HostpoolName <Your Host Pool Name> ResourceGroupName <Your Resource Group Name>

Refer this blog to get the session Recent/Old Session Host using the Get-AvdImageVersionStatus Command.

Upvotes: 0

Related Questions