az containerapp create with yaml & identity?

Zach Howell 85 Reputation points
2025-12-16T18:22:32.57+00:00

I'm trying to swap from using `az containerapp create with all args to using the --yaml variant. Are there any good examples of creating an app with an image from a private container registry and/or Dockerfile?

I found this example:

https://techcommunity.microsoft.com/blog/appsonazureblog/deploy-containers-to-azure-container-apps-workload-profiles-using-yaml/3962211

which uses the yaml format, but in general have not found very many resources to setup in this fashion. Some others include:
https://learn.microsoft.com/en-us/azure/container-apps/azure-resource-manager-api-spec?tabs=yaml

& overall documentation at get response docs. However these use hardcoded public images & don't include examples of RegistryCredentials or ManagedServiceIdentity.
From trying to work through this with AI chat, I first got the error:

ERROR: Failed to provision revision for container app 'your-app-name'. Error details: Identity with resource ID 'system' not found for registry your-regsitry.azurecr.io.

& then I tried using UserAssignedIdentity, setting up a custom role with az identity & giving it AcrPull permissions. Then I got error:
Failed to perform resource identity operation.``BadRequest","message":"Resource '/subscriptions/123/resourcegroups/rg123/providers/Microsoft.Managedidentity/Userassignedidentities/Youridentity' was not found."}}'.'

One thing odd about this last error is that my actual identity is youridentity lowercase & this (lowercase) is also how I wrote it in the yaml, but the error message displays with a capital Y.

Anyway, this is all getting rather complicated & it seems like there's something different going on with identity between the az containerapp create command with & without yaml. Does the no yaml route auto setup some identities for you while the yaml route does not? Therefore I'd just love an example tutorial of using a private registry with --yaml.

..why yaml in general? I have a script for creating apps & with yaml I can set some additional parameters which I now need (specifically for me increasing the start time for health checks so a slow image can startup without being killed).

Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
{count} votes

Answer accepted by question author
  1. Pravallika KV 3,955 Reputation points Microsoft External Staff Moderator
    2025-12-17T22:30:38.2933333+00:00

    Hi @Zach Howell ,

    Thanks for the offline conversation.

    I am summarizing the discussion and posting as answer.

    Upon investigating further, the error occurred when using User Assigned Managed identity with registries in yaml.

    As a workaround, followed below steps to achieve the requirement.

    • Created a Container App using Azure CLI and enabled System Assigned Managed identity in portal.
    • Navigate to Container registries and assign ACR PULL role to container app's managed identity.

    Command:

    
    az role assignment create --assignee <ContainerAppSystemIdentityPrincipalID> --role AcrPull --scope /subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/providers/Microsoft.ContainerRegistry/registries/<ACRName>
    
    
    • Explicitly configured the registries section with the identity: system in the yaml. This tells Azure Container Apps to use the system-assigned managed identity for authenticating to the ACR.
    
    properties:
    
      configuration:
    
        ingress:
    
          external: true
    
          allowInsecure: false
    
          targetPort: 80
    
        registries:
    
          - server: myregistry.azurecr.io
    
            identity: system
    
      template:
    
        containers:
    
        - image: mcr.microsoft.com/azuredocs/containerapps-helloworld:latest
    
          name: app
    
          resources:
    
              cpu: 0.5
    
              memory: 1Gi
    
    

    Hope it helps!


    Please do not forget to click "Accept the answer” and Yes, this can be beneficial to other community members.

    User's image

    If you have any other questions, let me know in the "comments" and I would be happy to help you.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.