[英]Azure Bicep giving InvalidTemplateDeployment error for Azure App Service Plan deployment
I'm trying to create App Service Plan using Bicep.我正在尝试使用二头肌创建应用服务计划。 I've created a full blown bicep script for the development infra and it is working fine.
我已经为开发基础设施创建了一个完整的二头肌脚本,它运行良好。 But for production when I'm executing the app Service plan module, I'm receiving the below error.
但是对于生产,当我执行应用服务计划模块时,我收到以下错误。 I've almost spent a day for troubleshooting this issue.
我几乎花了一天的时间来解决这个问题。 The module was also having bicep for deploying and configuring App Services.
该模块还具有用于部署和配置应用服务的二头肌。 But for troubleshooting I've removed it.
但是为了排除故障,我已将其删除。 Kindly help me in identifying this issue.
请帮助我确定这个问题。
Main file主文件
@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
}
}
Module模块
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'
}
Execucted using PowerShell使用 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 ....
Try this for your module:试试这个为你的模块:
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'
properties: {}
}
Supplying an empty properties object on the resource.在资源上提供空属性 object。 It shouldn't be required but seems like it is in this case and bicep didn't flag it.
它不应该是必需的,但在这种情况下似乎是必需的,并且二头肌没有标记它。 (issue here )
( 这里的问题)
Thanks...adding Properties fixed my issues... Looks like a bug...谢谢...添加属性解决了我的问题...看起来像一个错误...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.