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>.
- 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. - 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
- 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!