I am having a VMs in Azure and AD VM also in Azure. They are all in same network, although in different subnets.
I have provisioned the VM's by terraform and they are unable to join to AD, hence I am doing manually to see what the error is.
Commands to connect VM to AD is below:
PS C:\Users\scmadmin> $domain = "contoso.com"
PS C:\Users\scmadmin> $password = "<password here>" | ConvertTo-SecureString -asPlainText -Force
PS C:\Users\scmadmin> $username = "$domain\scmadmin"
PS C:\Users\scmadmin> $credential = New-Object System.Management.Automation.PSCredential($username,$password)
PS C:\Users\scmadmin> Add-Computer -DomainName $domain -Credential $credential
The log output after the execution is below:
Add-Computer : Computer 'erxprebussvc01' failed to join domain 'contoso.com' from its current workgroup 'WORKGROUP'
with following error message: Cannot complete this function.
At line:1 char:1
+ Add-Computer -DomainName $domain -Credential $credential
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (erxprebussvc01:String) [Add-Computer], InvalidOperationException
+ FullyQualifiedErrorId : FailToJoinDomainFromWorkgroup,Microsoft.PowerShell.Commands.AddComputerCommand
At Virtual Network level, DNS Server IP is the IP (Private IP) of AD=10.112.1.4
I am able to ping domain,
PS C:\Users\scmadmin> ping contoso.com
Pinging contoso.com [10.112.1.4] with 32 bytes of data:
Reply from 10.112.1.4: bytes=32 time=1ms TTL=128
Reply from 10.112.1.4: bytes=32 time=1ms TTL=128
Reply from 10.112.1.4: bytes=32 time=1ms TTL=128
Reply from 10.112.1.4: bytes=32 time=1ms TTL=128
Ping statistics for 10.112.1.4:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
Windows Event viewer log reports the below error
The machine erxprebussvc01 attempted to join the domain contoso.com but failed. The error code was 1355.
Unable to understand what is the issue/how to troubleshoot and how to resolve it.