|
2 | 2 | title: Define multiple instances of a property
|
3 | 3 | description: Use copy operation in an Azure Resource Manager template (ARM template) to iterate multiple times when creating a property on a resource.
|
4 | 4 | ms.topic: conceptual
|
5 |
| -ms.date: 05/07/2021 |
| 5 | +ms.date: 12/20/2021 |
6 | 6 | ---
|
7 | 7 |
|
8 | 8 | # Property iteration in ARM templates
|
@@ -93,7 +93,7 @@ The following example shows how to apply copy loop to the `dataDisks` property o
|
93 | 93 | }
|
94 | 94 | ```
|
95 | 95 |
|
96 |
| -Notice that when using `copyIndex` inside a property iteration, you must provide the name of the iteration. Property iteration also supports an offset argument. The offset must come after the name of the iteration, such as `copyIndex('dataDisks', 1)`. |
| 96 | +Notice that when using [copyIndex](template-functions-numeric.md#copyindex) inside a property iteration, you must provide the name of the iteration. Property iteration also supports an offset argument. The offset must come after the name of the iteration, such as `copyIndex('dataDisks', 1)`. |
97 | 97 |
|
98 | 98 | The deployed template becomes:
|
99 | 99 |
|
@@ -124,7 +124,7 @@ The deployed template becomes:
|
124 | 124 | ...
|
125 | 125 | ```
|
126 | 126 |
|
127 |
| -The copy operation is helpful when working with arrays because you can iterate through each element in the array. Use the `length` function on the array to specify the count for iterations, and `copyIndex` to retrieve the current index in the array. |
| 127 | +The copy operation is helpful when working with arrays because you can iterate through each element in the array. Use the [length](template-functions-array.md#length) function on the array to specify the count for iterations, and `copyIndex` to retrieve the current index in the array. |
128 | 128 |
|
129 | 129 | The following example template creates a failover group for databases that are passed in as an array.
|
130 | 130 |
|
@@ -212,36 +212,7 @@ The `copy` element is an array so you can specify more than one property for the
|
212 | 212 | }
|
213 | 213 | ```
|
214 | 214 |
|
215 |
| -The deployed template becomes: |
216 |
| - |
217 |
| -```json |
218 |
| -{ |
219 |
| - "name": "examplevm", |
220 |
| - "type": "Microsoft.Compute/virtualMachines", |
221 |
| - "apiVersion": "2020-06-01", |
222 |
| - "properties": { |
223 |
| - "storageProfile": { |
224 |
| - "dataDisks": [ |
225 |
| - { |
226 |
| - "lun": 0, |
227 |
| - "createOption": "Empty", |
228 |
| - "diskSizeGB": 1023 |
229 |
| - }, |
230 |
| - { |
231 |
| - "lun": 1, |
232 |
| - "createOption": "Empty", |
233 |
| - "diskSizeGB": 1023 |
234 |
| - }, |
235 |
| - { |
236 |
| - "lun": 2, |
237 |
| - "createOption": "Empty", |
238 |
| - "diskSizeGB": 1023 |
239 |
| - } |
240 |
| - ], |
241 |
| - ... |
242 |
| -``` |
243 |
| - |
244 |
| -You can use resource and property iteration together. Reference the property iteration by name. |
| 215 | +You can use resource and property iterations together. Reference the property iteration by name. |
245 | 216 |
|
246 | 217 | ```json
|
247 | 218 | {
|
@@ -291,4 +262,4 @@ The following example shows a common scenario for creating more than one value f
|
291 | 262 | - [Variable iteration in ARM templates](copy-variables.md)
|
292 | 263 | - [Output iteration in ARM templates](copy-outputs.md)
|
293 | 264 | - If you want to learn about the sections of a template, see [Understand the structure and syntax of ARM templates](./syntax.md).
|
294 |
| -- To learn how to deploy your template, see [Deploy resources with ARM templates and Azure PowerShell](deploy-powershell.md). |
| 265 | +- To learn how to deploy your template, see [Deploy resources with ARM templates and Azure PowerShell](deploy-powershell.md). |
0 commit comments