我尝试最小化我的 ARM 模板,但我被困在这里......
我的原始模板是:
"parameters": {
"subscriptionId": {
"type": "String"
},
"resourcegroupName": {
"type": "String"
},
.....
"databases": {
"type": "Array"
},
"failoverPolicy": {
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Sql/servers/failoverGroups",
"name": "[concat(parameters('primaryServer'), '/', parameters('failovergroupName'))]",
"apiVersion": "2015-05-01-preview",
"location": "eastus",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "[parameters('failoverPolicy')]"
},
"partnerServers": [
{
"id": "[concat('/subscriptions/',parameters('subscriptionId'),'/resourceGroups/',parameters('resourcegroupName'),'/providers/Microsoft.Sql/servers/',parameters('partnerServer'))]"
}
],
"databases": "[parameters('databases')]"
},
"dependsOn": [
"[concat('Microsoft.Sql/servers/',parameters('partnerServer'))]",
"[concat('Microsoft.Sql/servers/',parameters('partnerServer'),'/elasticPools/',parameters('primaryElasticPoolName'))]"
]
},
....
我的参数文件包含:
"parameters": {
"subscriptionId": {
"value": "11111-4444-5555-666-777777777"
},
"resourcegroupName": {
"type": "RG-ElasticPool"
},
"primaryElasticPoolName": {
"value": "crelasticpool01"
},
....
"databases": {
"value": [
"/subscriptions/11111-4444-5555-666-777777777/resourceGroups/RG-ElasticPool/providers/Microsoft.Sql/servers/crelasticsrv01/databases/crelasticdb03",
"/subscriptions/11111-4444-5555-666-777777777/resourceGroups/RG-ElasticPool/providers/Microsoft.Sql/servers/crelasticsrv01/databases/crelasticdb02",
"/subscriptions/11111-4444-5555-666-777777777/resourceGroups/RG-ElasticPool/providers/Microsoft.Sql/servers/crelasticsrv01/databases/crelasticdb01"
]
},
"failoverPolicy": {
"value": "Manual"
}
}
我只能:
"databases": {
"value": [
"crelasticdb03",
"crelasticdb02",
"crelasticdb01"
]
在我的参数文件中,而不是长 id,并在我的模板文件中连接长 id
我尝试了几个配置,例如:
"databases": "[concat('/subscriptions/',parameters('subscriptionId'),'/resourceGroups/',parameters('resourcegroupName'),'/providers/Microsoft.Sql/servers/',parameters('primaryServer'),'/databases/',parameters('databases')[copyIndex()])]"
但我总是收到与 copyindex 相关的部署错误...