Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource hostPool 'Microsoft.DesktopVirtualization/hostPools@2023-09-05' Unable to get token by hostPool.properties.registrationInfo.token with 2023-09-05 #2316

Open
chitharthipalanisamy opened this issue Sep 27, 2024 · 1 comment

Comments

@chitharthipalanisamy
Copy link

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)

Screenshot 2024-09-27 195911

@stephaniezyen
Copy link
Contributor

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.

@stephaniezyen stephaniezyen transferred this issue from Azure/bicep Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants