gpt4 book ai didi

Azure Bicep 无法为 Azure Function App 创建托管计划

转载 作者:行者123 更新时间:2023-12-03 05:19:21 25 4
gpt4 key购买 nike

我正在尝试使用 Azure Bicep 部署 Azure Function App。它失败并显示以下错误消息

{
"code": "InvalidTemplateDeployment",
"message": "The template deployment 'functionApp' is not valid according to the validation procedure. The tracking id is '879adf4b-de3b-4041-b1ea-dbd4b456efaa'. See inner errors for details."
}

Inner Errors: {
"message": "Object reference not set to an instance of an object."
}

我尝试单独部署函数应用程序所需的每个资源(存储帐户、托管计划和应用程序见解)。存储帐户和应用程序见解可以很好地创建。但不是托管计划...

有人能看出我做错了什么吗?我已经分解了托管部分并尝试创建它,但收到与上面相同的错误消息

Bicep 文件如下所示:

param functionAppName string = 'abctest'
param env string = 'pri2'
param location string = 'westeurope'

var hostingPlanName = '${functionAppName}-${env}-plan'

resource hostingPlanName_resource 'Microsoft.Web/serverfarms@2020-10-01' = {
name: hostingPlanName
location: location
sku: {
tier: 'Y1'
name: 'Dynamic'
}
}

最佳答案

与此帖子相关:Azure Bicep - Object reference not set to an instance .

您需要添加一个空的properties对象:

properties: {}

同时根据documentation ,您的模板中的 sku 和名称无效。

这应该有效:

resource hostingPlanName_resource 'Microsoft.Web/serverfarms@2020-10-01' = {
name: hostingPlanName
location: location
sku: {
name: 'Y1'
tier: 'Dynamic'
}
properties: {}
}

关于Azure Bicep 无法为 Azure Function App 创建托管计划,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73501034/

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