bicep icon indicating copy to clipboard operation
bicep copied to clipboard

ContainerApps@2022-03-01 cannot handle conditional registries

Open Gordonby opened this issue 3 years ago • 3 comments

Bicep version Bicep CLI version 0.8.9 (33a85174de) and Bicep CLI version 0.9.1 (a2950a16df)

Describe the bug I'm able to deploy a bicep file that creates a ContainerApp with a registry specified. However when I make the registry property conditional, I get this error;

"code": "ContainerAppInvalidSchema", "message": "Invalid request body for container app. Does not conform to Container App schema"

works;

      registries: [
        {
          identity: uai.id
          server: acr.outputs.loginServer
        }
      ]

also works;

      registries: []

causes the weird error;

      registries: someBooleanVar ? [] : [
        {
          identity: uai.id
          server: acr.outputs.loginServer
        }
      ]

Quite frustrating....

To Reproduce Reproduceable from branch https://github.com/Gordonby/azure-quickstart-templates/blob/gb-containerAppRegistryIssue/quickstarts/microsoft.app/container-app-acr/main.bicep#L117

cd quickstarts\microsoft.app\container-app-acr
az group create -n innerloopeastus -l eastus
az deployment group create -g innerloopeastus -f .\main.bicep

Gordonby avatar Aug 04 '22 17:08 Gordonby

@Gordonby -- can you share the full error message ideally with a correlation ID? We think this may be happening during preflight validation on the resource provider, but we need to confirm that.

@stephaniezyen FYI

alex-frankel avatar Aug 10 '22 19:08 alex-frankel

@alex-frankel @stephaniezyen

{"code": "InvalidTemplateDeployment", "message": "The template deployment 'main' is not valid according to the validation procedure. The tracking id is '90c85523-62c0-4794-985b-edf99267b4d9'. See inner errors for details."}

Inner Errors: {"code": "ValidationForResourceFailed", "message": "Validation failed for a resource. Check 'Error.Details[0]' for more information."}

Inner Errors: {"code": "ContainerAppInvalidSchema", "message": "Invalid request body for container app. Does not conform to Container App schema, please visit for more information https://docs.microsoft.com/azure/container-apps/azure-resource-manager-api-spec?tabs=arm-template#container-app"}

Gordonby avatar Aug 10 '22 20:08 Gordonby

@ruslany I think this is an issue with the preflight implementation for container apps. Any chance you can take a look?

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

Reached out to container apps team. Waiting to hear back on a response.

stephaniezyen avatar Sep 07 '22 18:09 stephaniezyen

Fantastic. Having a fix for this would greatly simplify the bicep module created here https://github.com/Azure/bicep-registry-modules/pull/136 and make iterating on the module much, much easier.

Gordonby avatar Sep 08 '22 12:09 Gordonby

@Gordonby team is aware of the issue and has a plan to fix it soon! Will continue following up on this issue.

stephaniezyen avatar Sep 12 '22 18:09 stephaniezyen

Tested with Microsoft.App/containerApps@2022-06-01-preview - not fixed yet.

Gordonby avatar Oct 06 '22 11:10 Gordonby