Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
It looks like you’ve successfully joined the VM to the domain manually, which is a good sign. This indicates that the network and domain settings are likely correct. The issue seems to be with the automated domain join process during provisioning. Here are some steps to troubleshoot and resolve this:
- Check the VM can communicate with the domain controller. Use
ping
ornslookup
commands from the VM to verify. - Make sure that the NSG (Network Security Group) and firewall rules allow traffic to the domain controller, especially over ports required for domain join (e.g., ports 88, 389, 445, etc.).
- The domain join extension is correctly configured in your Azure template. Verify the domain name, OU path, and credentials used in the extension settings.
- If the built-in domain join extension is failing, you might need to use a custom script to join the domain. Here’s a basic example of a PowerShell script to join a domain:
$domain = "yourdomain.com" $username = "domain\username" $password = "password" $secpasswd = ConvertTo-SecureString $password -AsPlainText -Force $credential = New-Object System.Management.Automation.PSCredential($username, $secpasswd) Add-Computer -DomainName $domain -Credential $credential -Restart
- Add this script to the custom script extension in your ARM template or Azure portal.
- Sometimes, the domain join process might fail due to timing issues, such as the VM not being fully ready or network services not being available. Adding a delay before the domain join script runs can help mitigate this.
- Check the logs for the domain join extension and custom script extension for any specific errors. These logs can provide more detailed information on why the domain join is failing.
For more details, you can refer to the below documents:
Troubleshoot Azure Virtual Desktop session host
Troubleshoot Windows VM extension provisioning errors
If you have any further queries, do let us know. If the comment is helpful, please click "Upvote".