bicep
bicep copied to clipboard
InvalidTemplateDeployment : Bicep Build does not report required property as Error
Bicep version Bicep CLI version 0.9.1 (a2950a16df)
Describe the bug Bicep Build does not report any error when run; however in the json output it reports: Missing required property "Properties" for Microsoft.Web/serverfarms.
When deployed we get:
ERROR: {"code": "InvalidTemplateDeployment", "message": "The template deployment 'blah' is not valid according to the validation procedure. The tracking id is 'blah_id'. See inner errors for details."}
Inner Errors: {"message": "Object reference not set to an instance of an object."}
To Reproduce Deploy a bicep template with Api version 2021-03-01 without a properties declaration.
Bicep:
resource servicePlan 'Microsoft.Web/serverfarms@2021-03-01' = { name: servicePlanName location: location kind: 'Windows' sku:{ name: svcPlanSku tier: svcPlanTier capacity: svcPlanInstanceCount } }
Arm Template Produced:
"resources": [ { "type": "Microsoft.Web/serverfarms", "apiVersion": "2021-03-01", "name": "[parameters('appServicePlanName')]", "location": "[parameters('location')]", "sku": { "name": "[parameters('svcPlanSku')]", "tier": "[parameters('svcPlanTier')]", "capacity": "[parameters('svcPlanInstanceCount')]" } }
Additional context The issue is resolved when a "properties" declaration is provided.
resource servicePlan 'Microsoft.Web/serverfarms@2021-03-01' = { name: servicePlanName location: location kind: 'Windows' sku:{ name: svcPlanSku tier: svcPlanTier capacity: svcPlanInstanceCount } properties:{ reserved: true zoneRedundant: false isSpot: false } }
Documentation only requires name and location.
[https://docs.microsoft.com/en-us/azure/templates/microsoft.web/2021-03-01/serverfarms?pivots=deployment-language-bicep]
Add any other context about the problem here.
Ran into the exact same issue as @zapadoody, hours lost before we stumbled onto this ticket here to resolve the issue. The most frustrating part was the lack of clarity in the error message, which did not help us pinpoint where to even start looking in our templates!
@zapadoody, @wahyuen - thanks for reporting this and I'm sorry for the frustration it caused. We are following up internally with the owners of the Microsoft.Web provider, and they are working on a fix.
Found this issue in version 2022-03-01 as well. Spent a day to figure it out.
My understanding is a fix for this is actively rolling out and should be fully resolved sometime next week.
Can anyone confirm if this issue has been resolved?
I can confirm that if you do not specify the properties
node, that ASP deployment can now succeed.
corresponding ARM template generated during deployment