You are managing container images in an Azure Container Registry (ACR) named `contosoregistry`. You need to configure the registry to meet the following requirements for an image named `payment-service:v2`:
* Prevent the image from being deleted.
* Prevent the image from being overwritten by subsequent build pipelines.
* Allow deployments to continue pulling the image.
Which two Azure CLI commands should you run to meet these requirements? (Select two.)
- az acr repository update --name contosoregistry --image payment-service:v2 --delete-enabled falseAnswer
- az acr repository update --name contosoregistry --image payment-service:v2 --write-enabled falseAnswer
- Caz acr repository update --name contosoregistry --image payment-service:v2 --read-enabled false
- Daz acr repository update --name contosoregistry --image payment-service:v2 --write-enabled true
- Eaz acr config retention update --registry contosoregistry --status enabled --days 7
Answer
Run `az acr repository update` with `--delete-enabled false` to prevent deletion and `--write-enabled false` to prevent overwriting, while ensuring read operations are not disabled.
To protect a container image in Azure Container Registry from deletion, you must disable delete operations using the `--delete-enabled false` parameter. To protect it from being overwritten (which is a write operation), you must disable write operations using the `--write-enabled false` parameter. Since pulling requires read access, the `--read-enabled` parameter must not be disabled.
Step-by-Step Solution
Key Concept
Locking container images in Azure Container Registry (ACR) to enforce immutability and prevent deletion or overwriting.
Estimated Time:2m 0s