How to add an existing Azure VM to a host pool?

Guang Li 0 Reputation points
2024-12-15T06:06:34.08+00:00

In context of Azure Virtual Desktop, I have moved a VM from a resource group to another resource group. The VM moving was successfully completed. But the VM is not assign to any host pool in the target resource group. It also didn't give me the chance to select the target host pool when moving the VM. Now I want to add the VM to an existing host pool in the resource group where the VM has just been moved to. How can I do it?

Problem: In the host pool, when I apply adding VM, it always try to create a new VM, and doesn't provide an option to select an existing VM.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,172 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,624 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Andreas Baumgarten 113.4K Reputation points MVP
    2024-12-15T08:02:05.84+00:00

    Hi @Guang Li ,

    first you you have to create a registration key: Generate a registration key

    Than you can add an existing Azure VM to an existing AVD host pool this way: Register session hosts to a host pool


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten

    0 comments No comments

  2. Prrudram-MSFT 27,251 Reputation points
    2024-12-15T19:27:15.1466667+00:00

    Hello @Guang Li

    As suggested by Andreas, you would need a registration key to complete this task of adding an existing VM to a host pool, you can follow these steps:

    Uninstall Existing Agents:

    • RDP into the VM you want to add to the host pool.
    • Uninstall the following agents: Remote Desktop Agent Bootloader Remote Desktop Service Infrastructure Agent

    Generate a Registration Key:

    • Sign in to the Azure portal.
    • Navigate to Azure Virtual Desktop and select Host pools.
    • Select the host pool you want to add the VM to.
    • Go to Registration key and generate a new key.

    Install Azure Virtual Desktop Agents:

    • On the VM, install the Azure Virtual Desktop Agent and Azure Virtual Desktop Agent Bootloader.
    • During the installation, use the registration key you generated.

    Verify the VM in the Host Pool:

    • After the installation, the VM should appear in the host pool.

    This process ensures that the VM is properly registered with the host pool using the correct agents and registration key

    If you encounter any issues, feel free to ask for further assistance!

    References: https://learn.microsoft.com/en-us/azure/virtual-desktop/add-session-hosts-host-pool?tabs=portal%2Cgui&pivots=host-pool-standard#register-session-hosts-to-a-host-pool

    https://learn.microsoft.com/en-us/azure/virtual-desktop/agent-overview?source=recommendations

    Add existing Azure VM to session host pool (Azure WVD)

    Add session hosts to a host pool - Azure Virtual Desktop

    If I have answered your question, please accept this as answer as a token of appreciation and don't forget to thumbs up for "Was it helpful"!


  3. Prrudram-MSFT 27,251 Reputation points
    2024-12-17T07:39:42.7566667+00:00

    Hello Guang Li

    The solution to your scenario is that you need to remove the VM from the old host pool first in the Azure portal, uninstall the RDAgent on the VM, reboot and then perform the steps to manually add the VM to the new host pool.
    Let me know once you do these steps.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.