You are deploying a new Azure Container App named `shipment-processor` to an Azure Container Apps environment. The container image is stored in a private Azure Container Registry (ACR) named `contosoregistry.azurecr.io`.
Security policies prohibit enabling the admin user on the ACR. You must configure the Container App to pull the image from the ACR using a managed identity with the least privilege.
You want to perform this deployment in a single CLI command execution without using temporary public images or bootstrap steps.
Which of the following approaches should you use to achieve this goal?
- Create a user-assigned managed identity, assign the AcrPull role to the identity on the ACR scope, and run the `az containerapp create` command with the `--user-assigned` and `--registry-identity` parameters configured to use this identity.Cevap
- BRun the `az containerapp create` command with the `--system-assigned` parameter, set `--registry-identity` to `system`, and then assign the AcrPull role to the generated system-assigned identity on the ACR scope.
- CEnable a system-assigned identity on the Azure Container Apps environment, grant the AcrPull role to the environment's identity on the ACR scope, and run the `az containerapp create` command without specifying registry credentials.
- DCreate a user-assigned managed identity, assign the Reader role to the identity on the ACR scope, and run the `az containerapp create` command with the `--user-assigned` and `--registry-identity` parameters configured to use this identity.
Cevap
Create a user-assigned managed identity, assign the AcrPull role to the identity on the ACR scope, and run the `az containerapp create` command with the `--user-assigned` and `--registry-identity` parameters configured to use this identity.
The correct approach uses a user-assigned managed identity because it can be pre-created and granted the AcrPull role on the Azure Container Registry prior to deploying the Container App. During the initial creation of the Container App, Azure needs to pull the container image from the private ACR. Since the user-assigned identity already has the required permissions, the deployment succeeds in a single step.
Adım Adım Çözüm
Anahtar Kavram
Azure Container Apps deployment with private registry authentication using a user-assigned managed identity.
Tahmini Süre:2m 0s