You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/templates/copy-resources.md
+62-4Lines changed: 62 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Deploy multiple instances of resources
3
3
description: Use copy operation and arrays in an Azure Resource Manager template (ARM template) to deploy resource type many times.
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-arm-template
6
-
ms.date: 05/22/2023
6
+
ms.date: 08/30/2023
7
7
---
8
8
9
9
# Resource iteration in ARM templates
@@ -91,7 +91,7 @@ The following example creates the number of storage accounts specified in the `s
91
91
Notice that the name of each resource includes the `copyIndex()` function, which returns the current iteration in the loop. `copyIndex()` is zero-based. So, the following example:
92
92
93
93
```json
94
-
"name": "[concat('storage', copyIndex())]",
94
+
"name": "[format('storage{0}', copyIndex())]",
95
95
```
96
96
97
97
Creates these names:
@@ -103,7 +103,7 @@ Creates these names:
103
103
To offset the index value, you can pass a value in the `copyIndex()` function. The number of iterations is still specified in the copy element, but the value of `copyIndex` is offset by the specified value. So, the following example:
104
104
105
105
```json
106
-
"name": "[concat('storage', copyIndex(1))]",
106
+
"name": "[format('storage{0}', copyIndex(1))]",
107
107
```
108
108
109
109
Creates these names:
@@ -156,6 +156,64 @@ The following example creates one storage account for each name provided in the
156
156
157
157
If you want to return values from the deployed resources, you can use [copy in the outputs section](copy-outputs.md).
158
158
159
+
### Use symbolic name
160
+
161
+
[Symbolic name](./resource-declaration.md#use-symbolic-name) will be assigned to resource copy loops. The loop index is zero-based. In the following example, `myStorages[1]` references the second resource in the resource loop.
Symbolic names can be used in [dependsOn arrays](./resource-dependency.md#depend-on-resources-in-a-loop). If a symbolic name is for a copy loop, all resources in the loop are added as dependencies. For more information, see [Depends on resources in a loop](./resource-dependency.md#depend-on-resources-in-a-loop).
216
+
159
217
## Serial or Parallel
160
218
161
219
By default, Resource Manager creates the resources in parallel. It applies no limit to the number of resources deployed in parallel, other than the total limit of 800 resources in the template. The order in which they're created isn't guaranteed.
@@ -244,7 +302,7 @@ The following example shows the implementation.
0 commit comments