Forum Discussion
Update to Microsoft Desktop Virtualization API v. 2023-09-05 by August 2, 2024 to avoid any impact
The provided samples are are intended solely for educational purposes. You should adapt them to fit your production use cases: e.g. you can store the resulting hostpool registrationToken in a keyvault and have all subsequent deployments access this value from key vault.
Even better, you can start using listRegistrationTokens() function instead, which will retrieve existing tokens and won't recreate them.
- Logan_SillimanJul 30, 2024Microsoft
JasonMasten official documentation will be updated soon! For now, please follow the recommendation from this blog post. For all intents and purposes, the list API behaves the same as Host Pools - Retrieve Registration Token - REST API (Azure Desktop Virtualization) | Microsoft Learn & its documentation may be helpful in the short term.
- HunterW620Jul 31, 2024Copper Contributor
Logan_Silliman what API version should be used for the new listRegistrationTokens() function?
I tried 2023-09-05 which is shown in this code example but I get error 404 while retrieveRegistrationToken does work. The API documentation seems to only show 2022-02-10-preview but that doesn't work either.
- JasonMastenAug 04, 2024Microsoft
HunterW620 in my testing, I found I had to set the scope on the existing host pool resource with the subscription ID and resource group name. With the proper scope, in my compiled JSON there was an extensionResourceId (like Logan's example above). If I assumed the scope and didn't include it, the compiled JSON used a resourceId instead and failed. Also, the example Logan provided doesn't output the token but an array of data with the token. Using the bicep code below will get the token:
param hostPoolName string
resource hostPool 'Microsoft.DesktopVirtualization/hostPools@2023-09-05' existing = {
scope: resourceGroup(subscription().subscriptionId, resourceGroup().name)
name: hostPoolName
}
output registrationToken string = hostPool.listRegistrationTokens().value[0].token