You are configuring an existing Azure Container App named `my-app` to pull container images from a private Azure Container Registry (ACR) named `myregistry.azurecr.io`. You want to use a User-Assigned Managed Identity for authentication to adhere to the principle of least privilege. What is the correct sequence of steps to configure the container app to use the managed identity and deploy the image?
- 1Create the User-Assigned Managed Identity by running the command `az identity create --name my-identity --resource-group my-rg`.
- 2Assign the `AcrPull` role to the managed identity's principal ID at the Azure Container Registry scope using `az role assignment create`.
- 3Associate the managed identity with the Container App by running `az containerapp identity assign --name my-app --resource-group my-rg --user-assigned <identityResourceId>`.
- 4Configure the Container App registry credentials to map the server and the managed identity by running `az containerapp registry set --name my-app --resource-group my-rg --server myregistry.azurecr.io --identity <identityResourceId>`.
- 5Deploy the private container image to the Container App by running `az containerapp update --name my-app --resource-group my-rg --container-name my-container --image myregistry.azurecr.io/my-image:v1`.
Cevap
Create the User-Assigned Managed Identity, assign the AcrPull role to it over the registry scope, associate the identity with the Container App, configure the Container App registry credential helper, and then update the Container App image.
The correct order resolves dependencies strictly. The User-Assigned Managed Identity must be created first to obtain its configuration details. Then, permissions must be granted to the identity to authenticate with the container registry. Next, the identity must be bound to the Container App before configuring the app's registry settings to use it. Finally, the container image can be updated, allowing the app to authenticate, pull the image, and spin up a new revision.
Adım Adım Çözüm
Anahtar Kavram
Deploying Azure Container Apps with private registry pull using User-Assigned Managed Identity