My ARM template code fails with the following validation error.
The Domain join should wait until the custom script extension is complete. Kindly please see code below. I can't get my head around how the resource and subresource dependency work and how to name the resource. Appreciate if you can guide me to an article to learn.
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('varnodeNamePrefix'),copyindex(1),'/cse')]",
"apiVersion": "2017-03-30",
"location": "[variables('varlocation')]",
"dependsOn": [
"[concat(variables('varnodeNamePrefix'),copyindex(1))]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.8",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"https://XXXXXXXXXXX.blob.core.windows.net/powershelscripts/sqlcluster/InstallAdditionalModules.ps1"
]
},
"protectedSettings": {
"commandToExecute": "powershell.exe -ExecutionPolicy Unrestricted ./sqlcluster/InstallAdditionalModules.ps1",
"storageAccountName": "sdfsdfsdfsdf",
"storageAccountKey": "sdsdfsdf/BH9C+fdgdfgdfgdfg+fgdfgdfg=="
}
},
"copy": {
"name": "WinFeatures",
"count":"[variables('varvmCount')]"
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('varnodeNamePrefix'),copyindex(1),'/joindomain')]",
"location": "[resourceGroup().location]",
"dependsOn": ["[concat(variables('varnodeNamePrefix'),copyindex(1),'/cse')]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "JsonADDomainExtension",
"typeHandlerVersion": "1.3",
"autoUpgradeMinorVersion": true,
"settings": {
"Name": "[variables('vardomainToJoin')]",
"User": "[concat(variables('vardomainToJoin'), '\\', variables('vardomainUsername'))]",
"Restart": "true",
"Options": "[variables('vardomainJoinOptions')]"
},
"protectedSettings": {
"Password": "[variables('vardomainPassword')]"
}
},
"copy": {
"name": "joindomain",
"count":"[variables('varvmCount')]"
}