我有一个主模板和几个链接模板。我想传递带有特殊字符的参数并出现错误。谁知道怎么修它? 该问题是由最后链接的模板定义中的“ servicebus_1_connectionString”参数引起的。我提供了错误信息并修改了秘密中的几个字母,因此您可以概览一下,但仍然不会泄露我的秘密。
{
"$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": {
}
}
2020-02-26T09:47:34.3751880Z ##[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.
2020-02-26T09:47:34.3754763Z ##[error]Details:
2020-02-26T09:47:34.3758785Z ##[error]BadRequest: {
"error": {
"code": "InvalidRequestContent",
"message": "The request content was invalid and could not be deserialized: 'Error converting value \"Endpoint=sb://myservicebusname.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=I/COoOJCWH/PFMab0dzpseIbfA3+0sQMUj33d71/Rg4=\" to type 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Data.Definitions.DeploymentParameterDefinition'. Path 'properties.parameters.servicebus_1_connectionString', line 1, position 462.'."
}
}
2020-02-26T09:47:34.3786900Z ##[error]Task failed while creating or updating the template deployment.
编辑: 我通过更改将参数传递给以下内容的方式来解决它:
{
"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"
]
}
答案 0 :(得分:0)
几个选项:
答案 1 :(得分:0)
我通过更改将参数传递给以下内容的方式来解决它:
{
"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"
]
}