Azure 将带有特殊参数的变量传递到ARM模板时出错
我有一个主模板和两个链接模板。我想用特殊字符传递参数,但有一个错误。有人知道怎么修吗? 该问题是由上一个链接模板定义中的“servicebus_1_connectionString”参数引起的。我提供了错误信息,并修改了《秘密》中的几个字母,这样您就有了一个概览,但仍然没有透露我的秘密Azure 将带有特殊参数的变量传递到ARM模板时出错,azure,arm,arm-template,Azure,Arm,Arm Template,我有一个主模板和两个链接模板。我想用特殊字符传递参数,但有一个错误。有人知道怎么修吗? 该问题是由上一个链接模板定义中的“servicebus_1_connectionString”参数引起的。我提供了错误信息,并修改了《秘密》中的几个字母,这样您就有了一个概览,但仍然没有透露我的秘密 { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "conte
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"containerUri": {
"type": "string"
},
"containerSasToken": {
"type": "string"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-05-10",
"name": "AzureServiceBusLinkedTemplate",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('containerUri'), 'Infrastructure/AzureServiceBus.json', parameters('containerSasToken'))]"
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-05-10",
"name": "AppFunctionsLinkedTemplate",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('containerUri'), 'Infrastructure/AppFunctions.json', parameters('containerSasToken'))]"
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-05-10",
"name": "LogicAppLinkedTemplate",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('containerUri'), 'LogicApp.json', parameters('containerSasToken'))]"
},
"parameters": {
"servicebus_1_connectionString": "[reference('AzureServiceBusLinkedTemplate').outputs.SBNamespaceDefaultConnectionString.value]"
}
},
"dependsOn": [
"AzureServiceBusLinkedTemplate"
]
}
],
"outputs": {
}
}
编辑:
我通过将传递参数的方式更改为以下方式解决了此问题:
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-05-10",
"name": "LogicAppLinkedTemplate",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('containerUri'), 'LogicApp.json', parameters('containerSasToken'))]"
},
"parameters": {
"servicebus_1_connectionString": {
"value": "[reference('AzureServiceBusLinkedTemplate').outputs.SBNamespaceDefaultConnectionString.value]"
},
"logicAppName": {
"value": "DeployedFromVS"
}
}
},
"dependsOn": [
"AzureServiceBusLinkedTemplate"
]
}
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-05-10",
"name": "LogicAppLinkedTemplate",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('containerUri'), 'LogicApp.json', parameters('containerSasToken'))]"
},
"parameters": {
"servicebus_1_connectionString": {
"value": "[reference('AzureServiceBusLinkedTemplate').outputs.SBNamespaceDefaultConnectionString.value]"
},
"logicAppName": {
"value": "DeployedFromVS"
}
}
},
"dependsOn": [
"AzureServiceBusLinkedTemplate"
]
}
有几种选择:
我通过将传递参数的方式更改为以下方式解决了此问题:
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-05-10",
"name": "LogicAppLinkedTemplate",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('containerUri'), 'LogicApp.json', parameters('containerSasToken'))]"
},
"parameters": {
"servicebus_1_connectionString": {
"value": "[reference('AzureServiceBusLinkedTemplate').outputs.SBNamespaceDefaultConnectionString.value]"
},
"logicAppName": {
"value": "DeployedFromVS"
}
}
},
"dependsOn": [
"AzureServiceBusLinkedTemplate"
]
}
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-05-10",
"name": "LogicAppLinkedTemplate",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('containerUri'), 'LogicApp.json', parameters('containerSasToken'))]"
},
"parameters": {
"servicebus_1_connectionString": {
"value": "[reference('AzureServiceBusLinkedTemplate').outputs.SBNamespaceDefaultConnectionString.value]"
},
"logicAppName": {
"value": "DeployedFromVS"
}
}
},
"dependsOn": [
"AzureServiceBusLinkedTemplate"
]
}
谢谢你的回答。我不想使用嵌套模板,因为我想分离文件以获得更清晰的结构。然而,第3点听起来很合理。你可以称之为链接,这没关系。第3点是所有这些点中最不合理的一点。所列和链接的是不同类型的模板->它实际上不是传递参数的方式,这是唯一的方法