When deploying the AVD template, I encountered the issue: 'The hostname is already used by another device in this tenant?

Yogesh 5 Reputation points
2025-04-22T06:05:17.2866667+00:00

VM has reported a failure when processing extension 'AADLoginForWindows' (publisher 'Microsoft.Azure.ActiveDirectory' and type 'AADLoginForWindows'). Error message: 'AAD Join failed with status code: -2145648509. AzureSecureVMJoinOperation: DeviceEnroller::AzureSecureVMEnroll failed 0x801c0083. The hostname is already used by another device in this tenant, please change the VM name to redeploy the extension.'. More information on troubleshooting is available at https://aka.ms/vmextensionwindowstroubleshoot. . Click here for details

But i have no hostname as same how to fix this

Azure Virtual Desktop
Azure Virtual Desktop
A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
1,778 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mounika Reddy Anumandla 5,130 Reputation points Microsoft External Staff Moderator
    2025-04-22T09:53:22.9833333+00:00

    Hi Yogesh,

    I would like to understand if you are getting the same error when you change the vm name to something new and redeploy the extension?
    Please check the extension logs for more details C:\WindowsAzure\Logs\Plugins<extensionName>.

    1. Sometimes, there may be cached device registration entries that are preventing successful enrollment. To clear these, run the following command to remove the device from Azure AD:dsregcmd /leave. Restart and run: dsregcmd /status. If it reports "AzureAdJoined: No", it’s not registered yet. If "AzureAdJoined: Yes" still appears, try running dsregcmd /leave and then try to join again.
    2. Go to the VM's Extensions & applications blade. Ensure that AADLoginForWindows extension has been properly deployed. If the extension failed, try removing it and redeploying: Go to VM Extensions, find AADLoginForWindows, click Remove, and then try adding it back manually. https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/features-windows#rerun-a-vm-extension
    3. Sometimes, the issue can be specific to the VM image or a previous deployment failure. Try deploying a new VM using a different image or configuration to see if the issue persists.

    Please feel free to tag me in the comments for further queries!

    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.