Domain Join Extension for ARM Templates

Finally found a solution for joining an azure virtual machine to a domain with an ARM templte without the use of extra powershell commands. The domain join extension is something new to be used. Could not find any information on it on internet other then people on github talking about how to add a VM to a domain. I tried this with DSC using the xcomputermanagement module, but this requestes the module to be installed on the freshly installed VM. Also tried this with a custom powershell script extension, but was unsure on how to pass the parameters from the json template to the custom script. The below looks like the solution to the problem.


Let’s see if it works ->

* the OUPATH follows the following notation: ou=DivisionA,dc=something,dc=net

 "name": "[concat(parameters('VirtualMachines'),'/extensions')]",
                     "type": "Microsoft.Compute/virtualMachines/extensions",
                     "location": "[resourceGroup().location]",
                     "apiVersion": "[parameters('apiVersion')]",
                     "dependsOn": [
                           "[concat('Microsoft.Compute/virtualMachines/', parameters('VirtualMachineName')]"
                     "properties": {
                           "publisher": "Microsoft.Compute",
                           "type": "JsonADDomainExtension",
                           "typeHandlerVersion": "1.0",
                           "settings": {
                                  "Name": "domainName",
                                  "OUPath": "OUPATH",
                                  "User": "domain\username or username@domain",
                                  "Restart": "true",
                                  "Options" :  3

                           "protectedsettings": {
                                  "Password": "user pass"

The “JsonADDomainExtension” has exactly one hit on google (27-12)

4 thoughts on “Domain Join Extension for ARM Templates

  1. I cannot get this to work at all! Can you show in template how exactly you position this? Do you add like a custom script or within the template itself? Really stuck.



      1. I’m getting an error that

        ‘GTM-Server-01/Server1JoinDomain’ failed with message ‘{
        “error”: {
        “code”: “ArtifactNotFound”,
        “message”: “Extension with publisher ‘Microsoft.Compute’, type ‘JsonADDomainExtension’, and type handler version
        ‘1.4’ could not be found in the extension repository.”

        Do you know where I can verify the extension repo?

Leave a Reply

Your email address will not be published. Required fields are marked *

16 − five =