Last active
November 26, 2020 09:37
-
-
Save kevinhillinger/fa3ae1b507c83ca806404017cf550ca2 to your computer and use it in GitHub Desktop.
Resource Manager (ARM) Template with copyIndex variable to output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$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" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing this!