繁体   English   中英

Azure Bicep 无法为 Azure Function 应用程序创建托管计划

[英]Azure Bicep fails to create hosting plan for Azure Function App

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

{
  "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."
}

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

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

二头肌文件如下所示:

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 object:

properties: {}

同样根据文档,您的模板中的 sku 和名称无效。

这应该工作:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM