How to generate new registration token for hostpool in AVD?

Himanshu Nankani 71 Reputation points
2022-05-19T07:44:17.98+00:00

How do I generate a new registration token for a hostpool in AVD (azure Virtual Desktop) through REST API?
I am able to create a hostpool using the REST API as given here:
https://learn.microsoft.com/en-us/rest/api/desktopvirtualization/host-pools

Since I am doing it from within my application, I am hitting the REST API for hostpool creation. It does creates the hostpool, but to add any session host I need the registration token which does not gets created with it. I can retrieve the old registration token also using REST API, which I created using portal but when it expires, is there any way to create it from API or ARM template? I can't allow user to go to portal so I have to do it from my application. Please do let me know is there a way for it or a better way to handle this.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,257 questions
Azure Virtual Desktop
Azure Virtual Desktop
A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
1,384 questions
0 comments No comments
{count} votes

Accepted answer
  1. Cédric Perion 171 Reputation points
    2022-05-20T19:12:21.473+00:00

    Hi HimanshuNankani-3787,

    Thanks to post question here, first i want to say you that i am not very familiar with REST API but i have make some research for you.
    First maybe you can create / update Registration Token by powershell ?
    Here some informations about that : https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/new-azwvdregistrationinfo?view=azps-7.5.0#example-1-create-a-windows-virtual-desktop-registration-token

    After that, i found this for REST API part : https://medium.com/wortell/getting-started-with-rest-api-for-wvd-arm-spring-release-and-sharing-my-github-examples-39593acb4c0e

    And this :
    https://learn.microsoft.com/en-us/rest/api/desktopvirtualization/host-pools/create-or-update#registrationtokenoperation

    Hope with all this informations, you can do what you need :)
    Perion Cédric

    ----------------------------------------------------------------------------------------------------------

    Accept Answer and Upvote, if any of the above helped, this thread can help others in the community looking for remediation for similar issues.

    NOTE: To answer you as quickly as possible, please mention me in your reply.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful