Understanding copy and copyIndex
There are many times when multiple instances of a particular resource or a group of resources are needed. For example, you may need to provision 10 virtual machines of the same type. In such cases, it is not prudent to deploy templates 10 times to create these instances. A better alternate approach is to use the copy
and copyIndex
features of ARM templates.
copy
is an attribute of every resource definition. This means it can be used to create multiple instances of any resource type.
Let's understand this with the help of an example of creating multiple storage accounts within a single ARM template deployment.
The next code snippet creates 10 storage accounts serially. They could have been created in parallel by using Parallel
instead of Serial
for the mode
property:
"resources": [ { "apiVersion": "2019-06-01"...