Your company uses an Azure Container Registry (ACR) named prodacr. You have created an ACR Task named build-app in prodacr that is configured to build an application image whenever the base image, which resides in a separate private ACR named sharedacr, is updated. You create a user-assigned managed identity named task-identity, assign it to the build-app task, and grant it the AcrPull role on sharedacr. Which command must you run to configure the task to use the user-assigned managed identity when pulling the base image from sharedacr?
- az acr task credential add --name build-app --registry prodacr --login-server sharedacr.azurecr.io --use-identity <client-id>Answer
- Baz acr task credential add --name build-app --registry prodacr --login-server sharedacr.azurecr.io --use-identity [system]
- Caz acr login --name sharedacr.azurecr.io --identity
- Daz acr task credential add --name build-app --registry prodacr --login-server sharedacr.azurecr.io --username <client-id> --password <client-secret>
Answer
Execute the 'az acr task credential add' command, specifying the task name, target registry, login server of the source registry, and the '--use-identity' parameter with the client ID of the user-assigned managed identity.
To authenticate an Azure Container Registry (ACR) Task to another private registry using a user-assigned managed identity, you must run the 'az acr task credential add' command. This command configures the specific login server credentials for the task. The '--use-identity' parameter must be set to the client ID of the user-assigned managed identity to ensure that the task uses the identity that has the AcrPull permission on the source registry.
Step-by-Step Solution
Key Concept
Configuring credentials and managed identities for Azure Container Registry Tasks to perform cross-registry image pulls.
Estimated Time:2m 0s