bicep icon indicating copy to clipboard operation
bicep copied to clipboard

InvalidTemplateDeployment : Bicep Build does not report required property as Error

Open wsucoug69 opened this issue 2 years ago • 1 comments

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.

wsucoug69 avatar Aug 08 '22 14:08 wsucoug69

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!

wahyuen avatar Aug 12 '22 05:08 wahyuen

@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.

anthony-c-martin avatar Aug 14 '22 19:08 anthony-c-martin

Found this issue in version 2022-03-01 as well. Spent a day to figure it out.

kaigalmane avatar Aug 26 '22 11:08 kaigalmane

My understanding is a fix for this is actively rolling out and should be fully resolved sometime next week.

alex-frankel avatar Aug 26 '22 20:08 alex-frankel

Can anyone confirm if this issue has been resolved?

alex-frankel avatar Sep 15 '22 14:09 alex-frankel

I can confirm that if you do not specify the properties node, that ASP deployment can now succeed.

image

corresponding ARM template generated during deployment

image

image

wahyuen avatar Sep 16 '22 00:09 wahyuen