Join Windows ARM VM to domain
In classic mode deployment we could deploy Azure VM's and have them automatically join to domain using the below command:
Add-AzureProvisioningConfig -AdminUserName $UserName -Password $Password -WindowsDomain -Domain $UserDomainName -DomainUserName $DomainUserName -DomainPassword $DomainUserPassword -JoinDomain $DomainName
How can we do the same operation for a Windows VM deployed in ARM mode using latest version of Azure powershell?
I believe the model for ARM would be to use DSC for post provisioning configuration as in this template https://github.com/Azure/azure-quickstart-templates/tree/master/active-directory-new-domain .
I looked at the template and but that does not help me meet my requirement. I also checked your advise on DSC "Publish-AzureRmVMDscConfiguration". But here are the challenges I foresee with this approach:
-
The scripts have to be ps1 or psm1. And to join a VM to a domain I will need to supply credentials for an account with permissions to join computer to domain within the script and in clear text.
-
Execution policy on the VM's based on version of Windows could pose a hurdle for scripts to run. Say in Windows 2008 the ExecutionPolicy is set to "Restricted" by default and in Windows 2012 it is "RemoteSigned".
So we need to come up with something else that may not add much manual tasks to just add a VM to a domain.
Closing as we solved this in #1316. See comments for instructions https://github.com/Azure/azure-powershell/issues/1316#issuecomment-167154425