gpt4 book ai didi

azure - 将数组类型作为参数传递给 AppService 插槽的应用程序设置时出错

转载 作者:行者123 更新时间:2023-12-03 04:08:11 25 4
gpt4 key购买 nike

使用“数组”类型的参数替换为网站槽应用程序设置的 AppService 部署失败,并出现以下错误。

2019-10-20T10:25:46.0572018Z ##[error]BadRequest: {
"Code": "BadRequest",
"Message": "HTTP request body must not be empty.",
"Target": null,
"Details": [
{
"Message": "HTTP request body must not be empty."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"ExtendedCode": "51016",
"MessageTemplate": "HTTP request body must not be empty.",
"Parameters": [],
"Code": "BadRequest",
"Message": "HTTP request body must not be empty."
}
}
],
"Innererror": null
}

使用的模板如下。当 Email__ToEmailAddress 参数更改为字符串类型时,部署会成功,但作为数组类型时,部署会失败。传递一个空数组或具有多个值的数组没有区别。

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"aseName": {
"type": "string"
},
"hostingPlanName": {
"type": "string"
},
"webAppName": {
"type": "string"
},
"appInsightsLocation": {
"type": "string"
},
"slotName": {
"type": "string"
},
"gatewayIPAddressRestriction": {
"type": "string"
},
"containerRegistryName": {
"type": "string"
},
"containerImageName": {
"type": "string"
},
"containerRegistryResourceGroup": {
"type": "string"
},
"vNetName": {
"defaultValue": "",
"type": "string"
},
"vNetResourceGroupName": {
"defaultValue": "",
"type": "string"
},
"Email__ToEmailAddress": {
"defaultValue": [
"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b7d2dad6dedbf7d3d8dad6ded999d4d8da" rel="noreferrer noopener nofollow">[email protected]</a>"
],
"type": "array"
},
"Email__FromEmailAddress": {
"defaultValue": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b0d5ddd1d9dcf0d4dfddd1d9de9ed3dfdd" rel="noreferrer noopener nofollow">[email protected]</a>",
"type": "string"
},
"Email__SmtpServerPort": {
"defaultValue": 2525,
"type": "int"
},
"Email__IsAuthenticationRequired": {
"defaultValue": false,
"type": "bool"
}
},
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-02-01",
"name": "[tolower(parameters('webAppName'))]",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', '/subscriptions/', subscription().subscriptionId,'/resourcegroups/', resourceGroup().name, '/providers/Microsoft.Web/serverfarms/', tolower(parameters('hostingPlanName')))]": "empty"
},
"resources": [
{
"apiVersion": "2016-08-01",
"type": "config",
"name": "web",
"dependsOn": [
"[tolower(parameters('webAppName'))]"
]
}
],
"properties": {
"name": "[tolower(parameters('webAppName'))]",
"serverFarmId": "[concat('/subscriptions/', subscription().subscriptionId,'/resourcegroups/', resourceGroup().name, '/providers/Microsoft.Web/serverfarms/', tolower(parameters('hostingPlanName')))]",
"hostingEnvironment": "[parameters('aseName')]"
},
"dependsOn": [
"[resourceId('microsoft.insights/components/', tolower(parameters('webAppName')))]"
]
},
{
"apiVersion": "2016-08-01",
"type": "Microsoft.Web/sites/slots",
"name": "[concat(tolower(parameters('webAppName')), '/', tolower(parameters('slotName')))]",
"location": "[resourceGroup().location]",
"comments": "This specifies the app service slot deployed to.",
"tags": {
"displayName": "Slot"
},
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
"siteConfig": {
"appSettings": [
{
"name": "Email__ToEmailAddress",
"value": "[parameters('Email__ToEmailAddress')]"
},
{
"name": "Email__FromEmailAddress",
"value": "[parameters('Email__FromEmailAddress')]"
},
{
"name": "Email__SmtpServerPort",
"value": "[parameters('Email__SmtpServerPort')]"
},
{
"name": "Email__IsAuthenticationRequired",
"value": "[parameters('Email__IsAuthenticationRequired')]"
}
],
"linuxFxVersion": "[concat('DOCKER|', reference(resourceId(parameters('containerRegistryResourceGroup'), 'Microsoft.ContainerRegistry/registries', parameters('containerRegistryName')), '2017-10-01').loginServer, '/', parameters('containerImageName'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', tolower(parameters('webAppName')))]"
]
},
{
"type": "Microsoft.Insights/components",
"name": "[tolower(parameters('webAppName'))]",
"apiVersion": "2014-04-01",
"location": "[parameters('appInsightsLocation')]",
"tags": {
"[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', tolower(parameters('webAppName')))]": "Resource"
},
"properties": {
"applicationId": "[tolower(parameters('webAppName'))]",
"Request_Source": "AzureTfsExtensionAzureProject"
}
}
]
}

感谢所有回复。

最佳答案

这可能与参数函数解析数组的方式有关。

尝试:

[数组(参数('Email__ToEmailAddress'))]

或者:

[[参数('Email__ToEmailAddress')]]

希望这有帮助。

关于azure - 将数组类型作为参数传递给 AppService 插槽的应用程序设置时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58472169/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com