Reputation: 71
I am using azure-arm template and below attempt in creating copy iteration failed in variables section. This is giving me error, saying nested is not supported, Am I missing anything, if nested copy is not supported, how to go ahead in creating array of objects containing array.
"copy": [
{
"name": "VmInfo",
"count": "[parameters('vmCount')]",
"input": {
"skuQualVmName": "[concat(parameters('vmName'), '-vm-', copyIndex('VmInfo',1))]",
"copy": [
"name": "vmInterfaceNames",
"count": "[parameters('nicCountPerVm')]",
"input": "[concat(parameters(vmName), '-vm-', copyIndex('VmInfo',1), '-nic-', copyIndex('vmInterfaceNames',1))]"
]
}
}
],
Also I want to know if mutliple copy statements are supported in variables, like below
....
"copy": [
{
"name": "publicIpAdressResourceArray",
"count": "[parameters('vmCount')]",
"input": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',concat('primary-ip-', parameters('vmNames')[copyIndex('publicIpAdressResourceArray')]))]"
}
}
]
},
"copy": [
{
"name": "networkInterfaceNames",
"count": "[mul(parameters('vmCount'),parameters('nicCountPerVm'))]",
"input": "[concat( parameters('vmNameSubString'), '-vm-', div(copyIndex('networkInterfaceNames'),parameters('nicCountPerVm')), '-nic-', mod(copyIndex('networkInterfaceNames'),parameters('nicCountPerVm')))]"
}
],
....
Upvotes: 1
Views: 877
Reputation: 72211
first copy is correct, for the second question, you can do this:
"copy": [
{
"name": "firstvar",
xxx
},
{
"name": "secondvar",
yyy
}
]
so just use a single copy statement for all the var iterations you need. if you are looking for a property of a variable, to be an array that needs to be generated\calculated - you can use nested deployments:
but, probably, your best bet - is calculating this outside of an arm template.
Upvotes: 1