You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Bicep部署Azure FunctionApp报错请求体缺少Properties对象问题咨询

问题背景

我尝试通过基础设施即代码(Infrastructure-as-code)的方式,使用Bicep文件定义资源来部署新的Azure FunctionApp,所用Bicep文件内容如下:

param name string
param location string = resourceGroup().location
param serverFarmID string

resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
  name: name
  location: location
  kind: 'functionapp'
  properties: {
    serverFarmId: serverFarmID
    enabled: true
    reserved: true
    siteConfig: {
      appSettings: [
        {
          name: 'AzureWebJobsStorage'
          value: 'DefaultEndpointsProtocol=https;AccountName=censored;AccountKey= censored;EndpointSuffix=core.windows.net'
        }
        {
          name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
          value: 'DefaultEndpointsProtocol=https;AccountName=censored;AccountKey= censored;EndpointSuffix=core.windows.net'
        }
        {
          name: 'WEBSITE_CONTENTSHARE'
          value: 'examplefunction'
        }
        {
          name: 'FUNCTIONS_WORKER_RUNTIME'
          value: 'node'
        }
        {
          name: 'FUNCTIONS_EXTENSION_VERSION'
          value: '~3'
        }
        {
          name: 'WEBSITE_NODE_DEFAULT_VERSION'
          value: '~12'
        }
      ]
    }
  }
}

部署时始终收到如下报错:

Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details. (Code: DeploymentFailed)
 - {
  "Code": "BadRequest",
  "Message": "Properties object is not present in the request body.",
  "Target": null,
  "Details": [
    {
      "Message": "Properties object is not present in the request body."
    },
    {
      "Code": "BadRequest"
    },
    {
      "ErrorEntity": {
        "ExtendedCode": "51006",
        "MessageTemplate": "{0} object is not present in the request body.",
        "Parameters": [
          "Properties"
        ],
        "Code": "BadRequest",
        "Message": "Properties object is not present in the request body."
      }
    }
  ],
  "Innererror": null
} (Code:BadRequest)

我已明确定义了FunctionApp的properties对象,若直接省略整个properties对象,又会收到properties取值非法的报错。

排查方案
  • 优先定位报错关联的资源:顶层的部署失败提示不会明确指向具体出错资源,你需要在部署操作详情中查看每个单独资源的部署状态,确认报错触发自哪个资源,避免仅排查你默认认为有问题的资源。
  • 全量检查所有资源定义:遍历Bicep文件中所有的resource块,核对每个资源对应API版本的必填参数,确认所有资源都正确配置了必填的properties字段,尤其注意文件末尾、代码量少容易被忽略的资源块。
  • 提前做模板校验:部署前执行az deployment group what-if命令做预校验,可以提前识别模板中的必填参数缺失类问题,减少实际部署的错误率。
问题根因

FunctionApp对应的配置段本身没有问题,报错原因是Bicep文件末尾遗漏了另一个仅4行代码的资源,该资源未配置properties对象,最终触发了本次报错。

内容的提问来源于stack exchange,提问作者DrEichenbach

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.25 00:54:03