Skip to content

Files

Latest commit

 

History

History
68 lines (52 loc) · 1.88 KB

container-apps-github-devops-setup.md

File metadata and controls

68 lines (52 loc) · 1.88 KB
author ms.service ms.custom ms.topic ms.date ms.author
craigshoemaker
container-apps
devx-track-azurecli
include
11/09/2022
cshoe
  1. Change into the src folder of the cloned repository.

    cd my-container-app
    cd src
  2. Create Azure resources and deploy a container app with the az containerapp up command.

    az containerapp up \
      --name my-container-app \
      --source . \
      --ingress external 
    
  3. In the command output, note the name of the Azure Container Registry.

  4. Get the full resource ID of the container registry.

    az acr show --name <ACR_NAME> --query id --output tsv
    

    Replace <ACR_NAME> with the name of your registry.

  5. Enable managed identity for the container app.

    az containerapp identity assign \
      --name my-container-app \
      --resource-group my-container-app-rg \
      --system-assigned \
      --output tsv
    

    Note the principal ID of the managed identity in the command output.

  6. Assign the AcrPull role for the Azure Container Registry to the container app's managed identity.

    az role assignment create \
      --assignee <MANAGED_IDENTITY_PRINCIPAL_ID> \
      --role AcrPull \
      --scope <ACR_RESOURCE_ID>
    

    Replace <MANAGED_IDENTITY_PRINCIPAL_ID> with the principal ID of the managed identity and <ACR_RESOURCE_ID> with the resource ID of the Azure Container Registry.

  7. Configure the container app to use the managed identity to pull images from the Azure Container Registry.

    az containerapp registry set \
      --name my-container-app \
      --resource-group my-container-app-rg \
      --server <ACR_NAME>.azurecr.io \
      --identity system
    

    Replace <ACR_NAME> with the name of your Azure Container Registry.