resource hostPool 'Microsoft.DesktopVirtualization/hostPools@2023-09-05' Unable to get token by hostPool.properties.registrationInfo.token with 2023-09-05 #2316
Bug Description:
Using Bicep, we are trying to automate the creation of the Application Group, Session Host, Workspace, and Hostpool (AVD). However, there are problems with the session host creation. When creating the host machine, the host pool registration token was not properly obtained and used.
I'm getting the error message below if I try to obtain the token using the above method
Error message:
The template output 'hostpoolToken' is not valid: The language expression property 'token' can't be evaluated.. (Code: DeploymentOutputEvaluationFailed, Target: hostpoolToken)
However, if I use the method below, the token was obtained by the code, and session host machines were created.
However, when I use the previously mentioned way, VS Code recommends applying "hostPool.properties.registrationInfo.token" instead of the reference(hostPool.id).registrationInfo.token (the token is retrieved using this method)
Unfortunately this is an issue with Microsoft.DesktopVirtualization, I would open a support ticket with that team and we will try to route it to the right repo.
Bicep Version: Bicep CLI version 0.29.47
Bug Description: Using Bicep, we are trying to automate the creation of the Application Group, Session Host, Workspace, and Hostpool (AVD). However, there are problems with the session host creation. When creating the host machine, the host pool registration token was not properly obtained and used.
main.bicep
module vmAgent './modules/sessionhost.bicep' = { name: 'vmagent' params: { resourceLocation:resourceLocation vmCount: vmCount vmPrefix : vmPrefix vmSize: vmSize vmImagePublisher: vmImagePublisher vmImageOffer:vmImageOffer vmImageSKU:vmImageSKU vmImageVersion:vmImageVersion osType: osType hostpoolName: hostpoolName existingSubnetName: existingSubnetName existingVNETName: existingVNETName existingVNETResourceGroup: existingVNETResourceGroup hostpoolToken: hpsessionhostDeployment.outputs.hostpoolToken } }
sessionhost.bicep
resource Microsoft_PowerShell_DSC 'Microsoft.Compute/virtualMachines/extensions@2020-06-01' = [ for i in range(0, vmCount): { //2020-06-01 parent: hoostpoolVM[i] name: 'Microsoft.PowerShell.DSC' location: resourceLocation properties: { autoUpgradeMinorVersion: true publisher: 'Microsoft.Powershell' type: 'DSC' typeHandlerVersion: '2.73' settings: { modulesUrl: envURL configurationFunction: 'Configuration.ps1\AddSessionHost' properties: { hostPoolName: hostpoolName registrationInfoToken: hostpoolToken } } } dependsOn: [ hoostpoolVM[i] ] } ]
hostpool.bicep
resource hostPool 'Microsoft.DesktopVirtualization/hostPools@2023-09-05' = { } output hostpoolToken string = hostPool.properties.registrationInfo.token
I'm getting the error message below if I try to obtain the token using the above method
Error message: The template output 'hostpoolToken' is not valid: The language expression property 'token' can't be evaluated.. (Code: DeploymentOutputEvaluationFailed, Target: hostpoolToken)
However, if I use the method below, the token was obtained by the code, and session host machines were created.
output hostpoolToken string = reference(hostPool.id).registrationInfo.token
However, when I use the previously mentioned way, VS Code recommends applying "hostPool.properties.registrationInfo.token" instead of the reference(hostPool.id).registrationInfo.token (the token is retrieved using this method)