Question

Difficulty: HardManage Container Images in Azure Container Registry

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.)

  1. az acr repository update --name contosoregistry --image payment-service:v2 --delete-enabled falseAnswer
  2. az acr repository update --name contosoregistry --image payment-service:v2 --write-enabled falseAnswer
  3. C
    az acr repository update --name contosoregistry --image payment-service:v2 --read-enabled false
  4. D
    az acr repository update --name contosoregistry --image payment-service:v2 --write-enabled true
  5. E
    az 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

1
Disable delete operations on the specific image tag
The command `az acr repository update --name contosoregistry --image payment-service:v2 --delete-enabled false` is executed, preventing the image from being deleted.
This directly fulfills the requirement to prevent accidental deletion.
2
Disable write operations on the specific image tag
The command `az acr repository update --name contosoregistry --image payment-service:v2 --write-enabled false` is executed, preventing the image from being overwritten.
This directly fulfills the requirement to prevent subsequent build pipelines from overwriting the image.
3
Ensure read operations remain enabled
Do not set `--read-enabled false`.
This ensures the image can still be pulled for deployments.

Key Concept

Locking container images in Azure Container Registry (ACR) to enforce immutability and prevent deletion or overwriting.
Estimated Time:2m 0s
Rate this question