Azure / avdaccelerator

AVD Accelerator deployment automation to simplify the setup of AVD (Azure Virtual Desktop) based on best practices
MIT License
342 stars 214 forks source link

Powershell Deployement Error in https://github.com/Azure/avdaccelerator/blob/main/workload/bicep/brownfield/appAttachToolsVM/Readme.md #674

Closed lavanack closed 1 month ago

lavanack commented 1 month ago

Hi

The following code doesn't work

New-AzDeployment `
    -Location '<Azure location>' `
    -TemplateFile 'https://raw.githubusercontent.com/Azure/avdaccelerator/main/workload/arm/brownfield/deployAppAttachToolsVM.json' `
    -adminUsername '<Local Admin User Name>' `
    -adminPassUseKv false `
    -adminPassword '<Password for Local Admin Account>' `
    -publicIPAllowed '<true or false (Determines if NIC will have a Public IP Address)>' `
    -OSoffer 'WindowsDesktop' `
    -SubnetName '<Name of Subnet where VM will be attached.>' `
    -vmDiskType '<Standard_LRS, StandardSSD_LRS or Premium_LRS>' `
    -vmName '<Name for VM>' `
    -VNet '<Object value surrounded by {} with comma seperated key pairs for desired VNet name, id, location and subscriptionName>' `
    -Verbose

Please find a fix below :

$Vnet = @{
    "name"             = '<Virtual NetworkName>'
    "id"               = '<Virtual Network Id>'
    "location"         = '<Azure location>'
    "subscriptionName" = '<Subscription Name>'
}

$TemplateParameterObject = @{
    "Location"        = '<Azure location>'
    "adminUsername"   = '<Local Admin User Name>'
    "adminPassUseKv"  = $false
    "adminPassword"   = <Clear Text Password>
    "publicIPAllowed" = '<$true or $false (Determines if NIC will have a Public IP Address)>'
    "OSoffer"         = 'Windows-11'
    "OSVersion"       = 'win11-23h2-ent'
    "SubnetName"      = '<Name of Subnet where VM will be attached.>'
    "vmDiskType"      = '<Standard_LRS, StandardSSD_LRS or Premium_LRS>'
    "vmName"          = '<Name for VM>'
    "VNet"            = $VNet
}
New-AzResourceGroupDeployment -ResourceGroupName $ResourceGroupName -TemplateUri 'https://raw.githubusercontent.com/Azure/avdaccelerator/main/workload/arm/brownfield/deployAppAttachToolsVM.json' -TemplateParameterObject $TemplateParameterObject -Verbose

You have a working code in my repo : https://github.com/lavanack/laurentvanacker.com/blob/master/Azure/Azure%20Virtual%20Desktop/MSIX/New-AzMSIXAppAttachVM.ps1#L191-L213

danycontre commented 1 month ago

@lavanack thanks for your feedback, we are reviewing.

@swathibhat1

danycontre commented 1 month ago

@JCoreMS please review this issue.

danycontre commented 1 month ago

@lavanack deployment code has been updated by @JCoreMS .

@swathibhat1