Jenson Joseph
Jenson Joseph

Reputation: 61

Set-AzureRmVMADDomainExtension fails to add VM to AD Domain

The below VM extension fails to add VM to the domain.

It works fine when the ‘Computer Account’ exists in the AD. If the ‘Computer Account’ do not exist (New Server) it fails.

Set-AzureRmVMADDomainExtension -TypeHandlerVersion '1.0' -JoinOption 3 -DomainName $strDomainDNSName -ResourceGroupName $strRes_GrpName -VMName $strHostName -Credential $objCred -OUPath $strServerOU -Restart

The join option 3 should complete the below actions.

Value Meaning NETSETUP_JOIN_DOMAIN 0x00000001 Joins the computer to a domain. If this value is not specified, joins the computer to a workgroup. NETSETUP_ACCT_CREATE 0x00000002 Creates the account on the domain.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa370433(v=vs.85).aspx

Found the below error details under Azure VM Extension:

[

{
    "code": "ComponentStatus/JoinDomainException for Option 3 meaning 'User Specified'/failed/1",
    "displayStatus": "Provisioning failed",
    "level": "Error",
    "message": "ERROR - Failed to join domain='MyAd.ad.company.co.uk', ou='OU=Computers,DC=MyAd,DC=ad,DC=company,DC=co,DC=uk', user='[email protected]', option='NetSetupJoinDomain, NetSetupAcctCreate' (#3 meaning 'User Specified'). Error code 2",
    "time": null
}

{
    "code": "ComponentStatus/JoinDomainException for Option 1 meaning 'User Specified without NetSetupAcctCreate'/failed/1",
    "displayStatus": "Provisioning failed",
    "level": "Error",
    "message": "ERROR - Failed to join domain='MyAd.ad.company.co.uk', ou='OU=Computers,DC=MyAd,DC=ad,DC=company,DC=co,DC=uk', user='[email protected]', option='NetSetupJoinDomain' (#1 meaning 'User Specified without NetSetupAcctCreate'). Error code 1332",
    "time": null
}

]

Upvotes: 1

Views: 8176

Answers (2)

jlo-gmail
jlo-gmail

Reputation: 5048

Mine was failing with "User Specified without NetSetupAcctCreate", error 1323 in the logs. I needed to update the username to include the domain, ie User= 'domainName\userName' Then it worked.

Upvotes: 0

Jenson Joseph
Jenson Joseph

Reputation: 61

Only the Built-in 'Computers' OU has the problem. Tried both 'OU=Computers,DC=MyAd,DC=ad,DC=company,DC=co,DC=uk' and 'CN=Computers,DC=MyAd,DC=ad,DC=company,DC=co,DC=uk'. Failed with same Error.

But other user created OU works fine. For Eg. 'OU=TSTVLAN,OU=MGTServers,,DC=MyAd,DC=ad,DC=company,DC=co,DC=uk'

Upvotes: 2

Related Questions