下面的VM扩展无法将VM添加到域。Set-AzureRmVMADDomainExtension无法将虚拟机添加到AD域
当AD中存在“计算机帐户”时,它工作正常。如果“计算机帐户”不存在(新服务器),则失败。
设置-AzureRmVMADDomainExtension -TypeHandlerVersion '1.0' -JoinOption 3 -DomainName $ strDomainDNSName -ResourceGroupName $ strRes_GrpName -VMName $ strHostName -Credential $ objCred -OUPath $ strServerOU -Restart
的连接选项3应完成以下动作。
值含义 NETSETUP_JOIN_DOMAIN 0x00000001将计算机连接到域。如果未指定此值,则将计算机连接到工作组。 NETSETUP_ACCT_CREATE 0x00000002在域上创建帐户。
https://msdn.microsoft.com/en-us/library/windows/desktop/aa370433(v=vs.85).aspx
下发现了Azure的VM扩展以下错误信息:
[
{
"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
}
]