An organization is setting up a secure containerized API in Azure Container Apps. The container image is stored in a private Azure Container Registry (ACR). When deploying the Container App for the first time using a Bicep template, the deployment fails during the container creation phase because the registry authentication is not established. You need to configure the Bicep template to successfully authenticate to the private registry during this initial deployment using a managed identity. Which configuration strategy should you implement to ensure the initial deployment succeeds?
- Configure a user-assigned managed identity, grant it the AcrPull role on the registry, and reference this identity in both the identity and registries configuration blocks of the Bicep template.Cevap
- BEnable a system-assigned managed identity in the Bicep template, grant it the AcrPull role on the registry, and reference the system-assigned identity in the registries configuration block of the same template.
- CRun the az acr login command on the deployment machine to authenticate the session, and omit the registries configuration block from the Bicep template.
- DConfigure a system-assigned managed identity and assign a Key Vault access policy to grant the Container App environment access to the registry credentials.
Cevap
Configure a user-assigned managed identity, grant it the AcrPull role on the registry, and reference this identity in both the identity and registries configuration blocks of the Bicep template.
The correct configuration strategy involves using a user-assigned managed identity. Since the user-assigned identity is a standalone Azure resource, it can be created and granted the AcrPull role on the private Azure Container Registry (ACR) before the Container App is deployed. When the Bicep template runs, referencing this identity in both the identity block and the registries configuration allows the Container Apps platform to authenticate and pull the image successfully on the initial deployment.
Adım Adım Çözüm
Anahtar Kavram
Deploying Azure Container Apps with private registry authentication using a user-assigned managed identity.