An Azure service that provides a general-purpose, serverless container platform.
The error means Azure Container Apps cannot authenticate to Azure Container Registry when pulling the image, even though the registry roles look correct. The usual causes are:
- The container app is not actually configured to use a managed identity for image pull.
- The managed identity that has
AcrPullis not the same identity the container app is using. - ACR is not configured to accept ARM/managed-identity tokens.
Use these checks and fixes:
- Verify ACR is configured for managed identity auth
Run:
If it is disabled, enable it:az acr config authentication-as-arm show -r <REGISTRY>
This is required for both system-assigned and user-assigned managed identities to pull images from ACR.az acr config authentication-as-arm update -r <REGISTRY> --status enabled - Confirm which identity the container app uses for image pull
In the Container App resource in the portal:- Go to Identity and check whether System assigned is On and/or which User-assigned identity is attached.
- Then go to Application → Containers → Edit and deploy and verify:
- Image source is Azure Container Registry.
- Authentication type is Managed identity.
- Managed identity is set to the same identity that has
AcrPullon the registry.
- If using system-assigned managed identity
Follow the documented flow:- In Edit a container, set:
- Image source = Azure Container Registry
- Authentication type = Managed identity
- Managed identity = System assigned
- Save and create the new revision.
The portal then attempts to automatically add the
AcrPullrole to that system-assigned identity. If it fails, manually assignAcrPullon the registry to the system-assigned identity and redeploy.
- In Edit a container, set:
- If using user-assigned managed identity
Ensure:- The user-assigned identity is attached to the container app.
- That same identity has
AcrPullon the registry (scope can be the registry or the specific repo). - The container definition’s Authentication type is Managed identity and the selected identity is this user-assigned identity.
- Redeploy a new revision after fixing configuration
Once ACR is configured for ARM tokens and the correct identity is selected in the container app, create a new revision (for example via Edit and deploy). The unauthorized error should stop once the identity and ACR configuration match.
If the error persists, also confirm that the image name and tag (api:latest in the error) exist in the registry and that there are no network/firewall rules blocking the Container Apps environment from reaching the registry.
References: