我为LogicApp project
创建了parameter file
。
当我尝试使用此参数文件进行部署时,它给出了以下error
-
Template deployment returned the following errors:
Resource MICROSOFT.WEB/CONNECTIONS 'demo-sbs' failed with message '{
"error": {
"code": "InvalidRequestContent",
"message": "The request content is not valid and could not be deserialized: 'The 'id' property 'aaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaa/providers/Microsoft.Web/locations/westeurope/managedApis/servicebus' under 'properties.api' is not valid.'."
}
}'
LogicApp.dev.parameters.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"value": "demoapp"
},
"ResourceGroupName": {
"value": "demo1"
},
"logicAppLocation": {
"value": "westeurope"
},
"logicAppEnvironment": {
"value": "DEV"
},
"sbs_Name": {
"value": "demo-sbs"
},
"sbs_Connection_Name": {
"value": "demo-sbs"
},
"sbs_Connection_DisplayName": {
"value": "demo-sbs"
},
"nok_cb2b_we_sbs_connectionString": {
"value": "Endpoint=sb://demo-sbs.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=asdasd/assasad"
},
"LogicAppIntegrationAccountName": {
"value": "intdemo"
},
"subscriptionId": {
"value": "aaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaa"
}
}
}
LogicApp.json (Resources section(
"resources": [
{
"type": "MICROSOFT.WEB/CONNECTIONS",
"apiVersion": "2016-06-01",
"name": "[parameters('demo-sbs_Connection_Name')]",
"location": "[parameters('logicAppLocation')]",
"properties": {
"api": {
"id": "[concat(parameters('subscriptionId'), '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'servicebus')]"
},
"displayName": "[parameters('demo-sbs_Connection_DisplayName')]",
"parameterValues": {
"connectionString": "[parameters('demo-sbs_connectionString')]"
}
}
}
问题出在下面一行——当我尝试像concat(parameters('subscriptionId')
一样对订阅 Id 使用参数时,它会给出上述错误,如果我使用concat(subscription().id
它工作正常。我也想为subscriptionId
使用参数。
这是您正在执行的操作的正确语法:
"api":{
"id":"[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/serviceBus')]"
}
嗯,那是因为这不是 Azure 中资源 ID 的样子。
/subscriptions/subscription_guid/resourceGroups/resource_group_name/providers/microsoft.insights/components/resource_name
这就是它的外观。要重新填充它,您可以使用resourceId
函数。链接
或者你可以使用 concat,但你需要重新处理相同的字符串,你可以使用 resourceGroup().id
来帮助你解决这个问题。