I'm trying to add an extension to an azure arm template, so when it loops around it adds the extension to each vm.
The full JSON is at the link below: https://pastebin.com/embed_iframe/7uvwdZ6e
The error I'm getting is:
Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The resource 'Microsoft.Compute/virtualMachines/vmt1dsc/extensions/CreateADPDC' at line
'0' and column '0' is defined multiple times in a template.
CreateADPDC' is the name of the extension.
Thanks in advance :)
your dsc extension (line 444, I believe) is this (and because of that it complains it is defined multipli times):
"name": "[concat(parameters('VMNames'),'/',parameters('vmNameDscConfig'))]",
but should be this:
"name": "[parameters('vmNameDscConfig')]",
small remark, you need full name\type for "sub" resource (think subnet, vm extension, nsg rule, etc) if you are declaring it as a stand alone resource, but yours is a nested resource of the VM resource, so type
should be extensions
, just like with other extensions, not:
"type": "Microsoft.Compute/virtualMachines/extensions",