无法使用 arm 模板上的参数值创建多个存储帐户
Unable to create multiple storage accounts with parameters value on arm template
我正在尝试使用 arm 模板创建多个存储帐户,但是我找不到使用名称作为参数创建的语法。下面是我的 template.json 文件
Template.json:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-
01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageName": {
"type": "array",
"metadata": {
"description": "storageaccountname"
}
}
},
"functions": [],
"variables": {},
"resources": [{
"name": "[concat('storage', uniqueString(resourceGroup().id),
parameters('storageName')[copyIndex('copystorage')])]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-04-01",
"tags": {
"displayName": "storageaccount1"
},
"location": "[resourceGroup().location]",
"kind": "StorageV2",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"copy": {
"name": "copystorage",
"count": "[length(parameters('storageName'))]"
}
}],
"outputs": {}
}
Parameters.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-
01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageName": {
"value": [
"storarm1",
"storearm2",
"storearm3"
]
}
}
}
so what should be the "name" property inorder to create storage accounts with
storearm1,storearm2 and storearm3
从
修改后
"名称": "[concat('storage', uniqueString(resourceGroup().id), 参数('storageName')[copyIndex('copystorage')])]",至
"名称": "[参数('storageName')[copyIndex('copystorage')]]",
我可以用这些名字创作
我正在尝试使用 arm 模板创建多个存储帐户,但是我找不到使用名称作为参数创建的语法。下面是我的 template.json 文件
Template.json:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-
01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageName": {
"type": "array",
"metadata": {
"description": "storageaccountname"
}
}
},
"functions": [],
"variables": {},
"resources": [{
"name": "[concat('storage', uniqueString(resourceGroup().id),
parameters('storageName')[copyIndex('copystorage')])]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-04-01",
"tags": {
"displayName": "storageaccount1"
},
"location": "[resourceGroup().location]",
"kind": "StorageV2",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"copy": {
"name": "copystorage",
"count": "[length(parameters('storageName'))]"
}
}],
"outputs": {}
}
Parameters.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-
01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageName": {
"value": [
"storarm1",
"storearm2",
"storearm3"
]
}
}
}
so what should be the "name" property inorder to create storage accounts with
storearm1,storearm2 and storearm3
从
修改后"名称": "[concat('storage', uniqueString(resourceGroup().id), 参数('storageName')[copyIndex('copystorage')])]",至
"名称": "[参数('storageName')[copyIndex('copystorage')]]",
我可以用这些名字创作