ContainerApps@2022-03-01 cannot handle conditional registries
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 -- 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 @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"}
@ruslany I think this is an issue with the preflight implementation for container apps. Any chance you can take a look?
Reached out to container apps team. Waiting to hear back on a response.
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 team is aware of the issue and has a plan to fix it soon! Will continue following up on this issue.
Tested with Microsoft.App/containerApps@2022-06-01-preview - not fixed yet.