我正在构建一个模板以使用该函数部署链接模板n次,copy
同时增加正在使用的对象变量(例如 from vmRole1
to vmRole2
),但似乎虽然我能够将适当的变量字符串连接在一起(例如variables('vmRole1').roleInstanceCount
)在传递给链接模板之前,它实际上从未被评估过。
有什么方法可以强制 ARM 模板在将其发送到链接模板之前实际评估循环内的连接字符串?
可变样本:
"vmRole1": {
...
"roleInstanceCount": 2,
...
}
资源样本:
{
"apiVersion": "2015-01-01",
"type": "Microsoft.Resources/deployments",
"name": "[concat('DeployRole',copyIndex(1) ,variables('vmRole1Name'))]",
"copy": {
"name": "rolecopy",
"count": 2
},
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "<proper URL here>",
"contentVersion": "1.0.0.0"
},
"parameters": {
...
"roleInstanceCount": { "value": "[concat('variables(', variables('singleQuote'), 'vmRole', copyIndex(1), variables('singlequote'), ').roleInstanceCount')]" },
...