Skip to content

Commit d307161

Browse files
authored
Merge pull request #78956 from tfitzmac/0606copy
added zero count
2 parents 52e40e7 + 52aadfb commit d307161

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

articles/azure-resource-manager/resource-group-create-multiple.md

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,55 @@
22
title: Deploy multiple instances of Azure resources | Microsoft Docs
33
description: Use copy operation and arrays in an Azure Resource Manager template to iterate multiple times when deploying resources.
44
services: azure-resource-manager
5-
documentationcenter: na
65
author: tfitzmac
7-
editor: ''
8-
96
ms.service: azure-resource-manager
10-
ms.devlang: na
117
ms.topic: conceptual
12-
ms.tgt_pltfrm: na
13-
ms.workload: na
14-
ms.date: 05/01/2019
8+
ms.date: 06/06/2019
159
ms.author: tomfitz
1610

1711
---
18-
# Deploy more than one instance of a resource or property in Azure Resource Manager Templates
12+
# Resource, property, or variable iteration in Azure Resource Manager templates
13+
14+
This article shows you how to create more than one instance of a resource, variable, or property in your Azure Resource Manager template. To create multiple instances, add the `copy` object to your template.
15+
16+
When used with a resource, the copy object has the following format:
17+
18+
```json
19+
"copy": {
20+
"name": "<name-of-loop>",
21+
"count": <number-of-iterations>,
22+
"mode": "serial" <or> "parallel",
23+
"batchSize": <number-to-deploy-serially>
24+
}
25+
```
26+
27+
When used with a variable or property, the copy object has the following format:
28+
29+
```json
30+
"copy": [
31+
{
32+
"name": "<name-of-loop>",
33+
"count": <number-of-iterations>,
34+
"input": <values-for-the-property-or-variable>
35+
}
36+
]
37+
```
38+
39+
Both uses are described in greater detail in this article. For a tutorial, see [Tutorial: create multiple resource instances using Resource Manager templates](./resource-manager-tutorial-create-multiple-instances.md).
40+
41+
If you need to specify whether a resource is deployed at all, see [condition element](resource-group-authoring-templates.md#condition).
1942

20-
This article shows you how to iterate in your Azure Resource Manager template to create more than one instance of a resource. If you need to specify whether a resource is deployed at all, see [condition element](resource-group-authoring-templates.md#condition).
43+
## Copy limits
2144

22-
For a tutorial, see [Tutorial: create multiple resource instances using Resource Manager templates](./resource-manager-tutorial-create-multiple-instances.md).
45+
To specify the number of iterations, you provide a value for the count property. The count can't exceed 800.
2346

47+
The count can't be a negative number. If you deploy a template with REST API version **2019-05-10** or later, you can set count to zero. Earlier versions of the REST API don't support zero for count. Currently, Azure CLI or PowerShell don't support zero for count, but that support will be added in a future release.
2448

25-
[!INCLUDE [updated-for-az](../../includes/updated-for-az.md)]
49+
The limits for the count are the same whether used with a resource, variable, or property.
2650

2751
## Resource iteration
2852

29-
When you must decide during deployment to create one or more instances of a resource, add a `copy` element to the resource type. In the copy element, you specify the number of iterations and a name for this loop. The count value must be a positive integer and can't be more than 800.
53+
When you must decide during deployment to create one or more instances of a resource, add a `copy` element to the resource type. In the copy element, specify the number of iterations and a name for this loop.
3054

3155
The resource to create several times takes the following format:
3256

@@ -67,7 +91,7 @@ Creates these names:
6791
* storage1
6892
* storage2.
6993

70-
To offset the index value, you can pass a value in the copyIndex() function. The number of iterations to perform is still specified in the copy element, but the value of copyIndex is offset by the specified value. So, the following example:
94+
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:
7195

7296
```json
7397
"name": "[concat('storage', copyIndex(1))]",
@@ -152,7 +176,7 @@ For information about using copy with nested templates, see [Using copy](resourc
152176
To create more than one value for a property on a resource, add a `copy` array in the properties element. This array contains objects, and each object has the following properties:
153177

154178
* name - the name of the property to create several values for
155-
* count - the number of values to create. The count value must be a positive integer and can't be more than 800.
179+
* count - the number of values to create.
156180
* input - an object that contains the values to assign to the property
157181

158182
The following example shows how to apply `copy` to the dataDisks property on a virtual machine:

0 commit comments

Comments
 (0)