Skip to content

Instantly share code, notes, and snippets.

@kevinhillinger
Last active November 26, 2020 09:37
Show Gist options
  • Save kevinhillinger/fa3ae1b507c83ca806404017cf550ca2 to your computer and use it in GitHub Desktop.
Save kevinhillinger/fa3ae1b507c83ca806404017cf550ca2 to your computer and use it in GitHub Desktop.
Resource Manager (ARM) Template with copyIndex variable to output
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageSettings": {
"type": "object",
"defaultValue": {
"count": 3,
"prefix": "baa"
}
}
},
"variables": {
"storageSettings": "[parameters('storageSettings')]",
"storage": {
"copy": [
{
"name": "accounts",
"count": "[parameters('storageSettings').count]",
"input": {
"name": "[concat(parameters('storageSettings').prefix, uniqueString(resourceGroup().id, string(copyIndex('accounts'))))]",
"resourceGroup": "[resourceGroup().name]"
}
}
]
}
},
"resources": [
{
"name": "[variables('storage').accounts[copyIndex()].name]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2016-12-01",
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"location": "[resourceGroup().location]",
"tags": {},
"properties": {
},
"copy": {
"name": "storageCopy",
"count": "[variables('storageSettings').count]"
}
}
],
"outputs": {
"storageAccounts": {
"value": "[variables('storage').accounts]",
"type": "array"
}
}
}
@ParthPurani
Copy link

Thank You :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment