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

Azure Bicep部署App Service Plan时出现InvalidTemplateDeployment错误求助

Azure Bicep生产环境部署App Service Plan报错InvalidTemplateDeployment排查求助

开发环境中,使用Azure Bicep创建App Service Plan的完整脚本运行正常,但生产环境执行App Service Plan模块时出现InvalidTemplateDeployment错误。已花费近一天时间排查,为定位问题已移除模块中部署配置App Services的代码,仍未解决。以下是相关代码及执行命令,恳请协助定位问题。

主文件(main.bicep)

@allowed([
  'aladdin'
])
@description('Environment Name')
param environmentPrefix string

@allowed([
  'uat'
  'prod'
])
@description('Environment Type')
param environmentType string
@allowed([
  'P1V3'
  'P2V3'
])
@description('App Services Plan SKU')
param appServicePlanSku string
var appRgName = 'rg-${environmentPrefix}-${environmentType}-ne-app01'
var appServicePlanName = 'asp-${environmentPrefix}-${environmentType}-ne-app01'

resource appResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  name: appRgName
  location: location
  tags: {
    environmentType: environmentType
    environmentPrefix: environmentPrefix
    role: 'Azure PAAS resources'
  }
}

module appServicePlan 'appServicePlan.bicep' = {
  scope: appResourceGroup
  name: 'appServicePlanModule'
  params: {
    appServicePlanName: appServicePlanName
    appServicePlanSku: appServicePlanSku
    location: location
  }
}

模块文件(appServicePlan.bicep)

param appServicePlanSku string
param appServicePlanName string
param location string

resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
  name: appServicePlanName
  location: location
  sku: {
    name: appServicePlanSku
    capacity: 1
  }
  kind: 'windows'
}

PowerShell执行命令

New-AzSubscriptionDeployment `
    -Name Production `
    -Location northeurope `
    -TemplateParameterFile "$biceptemplate\main.parameters.json" `
    -TemplateFile "$biceptemplate\main.bicep" `
    -environmentPrefix 'aladdin' `
    -verbose

错误信息

Error: Code=InvalidTemplateDeployment; Message=The template deployment 'Production' is not valid according to the validation procedure. The tracking id is ....

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.23 05:45:29