在arm termplate中,我如何使用copyindex生成如下序列:手臂01手臂02手臂03等等?
您可以像下面一样使用CopyIndex:
"name": "[concat('arm-', copyIndex())]"
使用CopyIndex的完整示例:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageCount": {
"type": "int",
"defaultValue": 2
}
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-04-01",
"name": "[concat(copyIndex(),'storage', uniqueString(resourceGroup().id))]",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"properties": {},
"copy": {
"name": "storagecopy",
"count": "[parameters('storageCount')]"
}
}
],
"outputs": {}
}
请参阅此documentation以阅读有关CopyIndex的更多信息。