microsoft / microsoft/GitHub-Copilot-for-Azure
azure-prepare: Container App Bicep references non-existent ACR image during provisioning
- Dominant language
- Python
- Stars
- 250
- Forks
- 204
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 67
Description
## Summary
When `azure-prepare` generates Bicep for a Container App with ACR, the generated `web.bicep` references `acr.properties.loginServer/web:latest` as the container image. This image doesn't exist in ACR during `azd provision` (it gets pushed during `azd deploy`), causing the Container App creation to fail with:
`
ContainerAppOperationError: Failed to provision revision for container app.
Error details: Invalid value: "crXXX.azurecr.io/web:latest": GET https:: MANIFEST_UNKNOWN: manifest tagged by "latest" is not found
`
## Steps to Reproduce
1. Use `azure-prepare` to generate IaC for a project with:
- A Container App (e.g., Python Flask with Dockerfile)
- An ACR for hosting the container image
2. Run `azd up --no-prompt`
3. Provisioning fails at the Container App resource because the ACR image doesn't exist yet
## Expected Behavior
The generated Bicep should use a **placeholder image** for initial provisioning (e.g., `mcr.microsoft.com/azuredocs/containerapps-helloworld:latest`). AZD replaces the image during the `deploy` phase via the `azd-service-name` tag, so the placeholder is only used for the initial resource creation.
## Actual Behavior
Bicep references `acr.properties.loginServer/web:latest` which doesn't exist in the newly created ACR, causing a `MANIFEST_UNKNOWN` error during provisioning.
## Workaround
Manually change the image in `web.bicep` to a public placeholder:
`icep
// Before (fails)
image: '\$\{acr.properties.loginServer\}/web:latest'
// After (works)
image: 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
`
Then run `azd up` again. AZD will build/push the real image and update the Container App during deploy.
## Environment
- AZD version: 1.20.3
- Skill: azure-prepare
- Services: Container App + Function App (Flex Consumption) + existing Cosmos DB
- Region: West US 2
## Impact
- Adds ~7 min of wasted time (failed provision + diagnosis + fix + retry)
- Creates orphan resources from the partial deployment that succeeded before the error
## Suggested Fix
In the Container Apps Bicep template/recipe used by `azure-prepare`, replace the ACR image reference with a public placeholder image for initial provisioning. This is the standard pattern used by AZD templates (e.g., `azd init -t` templates use placeholder images).
Contributor guide
Research direction
Start by locating the Container Apps Bicep template or recipe generated by azure-prepare and inspect how the ACR image is assigned in web.bicep. Compare it with the public placeholder image described in the issue, then run the reported azd up flow to confirm provisioning succeeds before deployment replaces the image.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100