This is possible using the copy
property in the template where you want to make use of your parameter array.
A simple example is something like this:
"parameters": {
"org": {
"type": "array",
"defaultValue": [
"contoso",
"fabrikam",
"coho"
]
}
},
"resources": [
{
"name": "[concat('storage', parameters('org')[copyIndex()])]",
"copy": {
"name": "storagecopy",
"count": "[length(parameters('org'))]"
},
...
}
]
The copyIndex
function allows the template to grab the correct value from the parameter array and the count is set by the length()
function so that you don't have to set that manually.
You can read up on how to make use of the property in different scenarios in the docs: https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-multiple#resource-iteration
The linked template docs also discuss the copy property when it comes to working with nested templates: https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-linked-templates#using-copy