Skip to content

Commit 3a2d84d

Browse files
committed
Refresh the multi-instance tutorial
1 parent a8c4539 commit 3a2d84d

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed
Loading

articles/azure-resource-manager/templates/template-tutorial-create-multiple-instances.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Create multiple resource instances
33
description: Learn how to create an Azure Resource Manager template (ARM template) to create multiple Azure resource instances.
44
author: mumian
5-
ms.date: 04/23/2020
5+
ms.date: 09/28/2022
66
ms.topic: tutorial
77
ms.author: jgao
88
ms.custom: devx-track-azurepowershell
@@ -55,9 +55,25 @@ From Visual Studio Code, make the following four changes:
5555
![Azure Resource Manager creates multiple instances](./media/template-tutorial-create-multiple-instances/resource-manager-template-create-multiple-instances.png)
5656
5757
1. Add a `copy` element to the storage account resource definition. In the `copy` element, you specify the number of iterations and a variable for this loop. The count value must be a positive integer and can't exceed 800.
58-
2. The `copyIndex()` function returns the current iteration in the loop. You use the index as the name prefix. `copyIndex()` is zero-based. To offset the index value, you can pass a value in the `copyIndex()` function. For example, `copyIndex(1)`.
59-
3. Delete the `variables` element, because it's not used anymore.
60-
4. Delete the `outputs` element. It's no longer needed.
58+
59+
```json
60+
"copy": {
61+
"name": "storageCopy",
62+
"count": 3
63+
},
64+
```
65+
66+
1. The `copyIndex()` function returns the current iteration in the loop. You use the index as the name prefix. `copyIndex()` is zero-based. To offset the index value, you can pass a value in the `copyIndex()` function. For example, `copyIndex(1)`.
67+
68+
```json
69+
"name": "[format('{0}storage{1}', copyIndex(), uniqueString(resourceGroup().id))]",
70+
```
71+
72+
```
73+
74+
1. Delete the `storageAccountName` parameter definition, because it's not used anymore.
75+
1. Delete the `outputs` element. It's no longer needed.
76+
1. Delete the `metadata` element.
6177

6278
The completed template looks like:
6379

@@ -70,10 +86,14 @@ The completed template looks like:
7086
"type": "string",
7187
"defaultValue": "Standard_LRS",
7288
"allowedValues": [
73-
"Standard_LRS",
89+
"Premium_LRS",
90+
"Premium_ZRS",
7491
"Standard_GRS",
75-
"Standard_ZRS",
76-
"Premium_LRS"
92+
"Standard_GZRS",
93+
"Standard_LRS",
94+
"Standard_RAGRS",
95+
"Standard_RAGZRS",
96+
"Standard_ZRS"
7797
],
7898
"metadata": {
7999
"description": "Storage Account type"
@@ -83,22 +103,22 @@ The completed template looks like:
83103
"type": "string",
84104
"defaultValue": "[resourceGroup().location]",
85105
"metadata": {
86-
"description": "Location for all resources."
106+
"description": "Location for the storage account."
87107
}
88108
}
89109
},
90110
"resources": [
91111
{
92112
"type": "Microsoft.Storage/storageAccounts",
93-
"apiVersion": "2019-04-01",
94-
"name": "[concat(copyIndex(),'storage', uniqueString(resourceGroup().id))]",
113+
"apiVersion": "2021-06-01",
114+
"name": "[format('{0}storage{1}', copyIndex(), uniqueString(resourceGroup().id))]",
95115
"location": "[parameters('location')]",
96116
"sku": {
97117
"name": "[parameters('storageAccountType')]"
98118
},
99119
"kind": "StorageV2",
100120
"copy": {
101-
"name": "storagecopy",
121+
"name": "storageCopy",
102122
"count": 3
103123
},
104124
"properties": {}
@@ -107,6 +127,8 @@ The completed template looks like:
107127
}
108128
```
109129

130+
Save the changes.
131+
110132
For more information about creating multiple instances, see [Resource iteration in ARM templates](./copy-resources.md)
111133

112134
## Deploy the template

0 commit comments

Comments
 (0)