microsoft / microsoft/openclaw-dev
bug: AcrPull role not assigned to container app managed identity — image pull 401 on partial first deploy
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 25
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Summary
On a first devclaw up where the ACA revision activation times out (Operation expired), the container app's system-assigned managed identity never gets the AcrPull role on ACR. Subsequent devclaw deploy calls push the image successfully but the container fails to start with a persistent 401.
Error seen in container system logs
Failed to construct registry secret for registry 'acrXXXXX.azurecr.io'
Error: ACR token exchange endpoint returned error status: 401
Steps to reproduce
- Run
devclaw upin a region/subscription where ACA revision activation times out on first run (e.g.southindiawith a cold ACA environment, or any restricted corporate subscription) - Provision completes (ACR ✓, OpenAI ✓, Storage ✓, ACA env ✓) but revision fails with
Operation expired - Run
devclaw deploy— image is pushed to ACR but container immediately fails with ACR 401
Root cause
Bicep provisions ACR with adminUserEnabled: false (correct) and the container app is configured to pull via system-assigned managed identity — but the AcrPull role assignment on ACR for the container app's principalId is either missing or not yet propagated when the first revision activation is attempted. When the first azd up doesn't complete cleanly, this RBAC gap is never resolved.
Expected behaviour
Bicep should create an explicit AcrPull role assignment resource scoped to the ACR for the container app's managed identity, with correct dependsOn sequencing so the role is in place before the first revision is activated.
Manual workaround
PRINCIPAL_ID=$(az containerapp show -n <app> -g <rg> --query 'identity.principalId' -o tsv)
ACR_ID=$(az acr show -n <acr> -g <rg> --query 'id' -o tsv)
az role assignment create \
--assignee-object-id $PRINCIPAL_ID \
--assignee-principal-type ServicePrincipal \
--role AcrPull \
--scope $ACR_ID
Environment
- Region:
southindia - Restricted corporate subscription with Azure Policy assignments active
azdversion: latest,azCLI: latest
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with devclaw up followed by devclaw deploy in the described Azure environment, then inspect the Bicep resources that provision ACR and the container app. Verify the managed identity, ACR scope, AcrPull role assignment, and dependency sequencing. Done means a partial first deployment followed by deploy starts the container without an ACR 401.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100