Immutable Azure Container Registry Image Selection with SHA Digests

AI-200 By islever Editorial Last updated

Short answer

D Pin the production deployment to the image's SHA-256 manifest digest, such as myregistry.azurecr.io/app@sha256:<digest>, so a moved production or latest tag cannot change the build that runs.

Question

You maintain multiple versions of a container image in Azure Container Registry. The production deployment must always run the exact same image build even if tags are changed later. You need to ensure predictable and immutable image selection during deployment. What should you do?
  1. Tag the image as production and deploy it by using the production tag.
  2. Schedule nightly rebuilds of the image.
  3. Configure deployment to use the latest tag.
  4. Identify the image by using its SHA digest. Correct Answer

Key Takeaways

Azure Container Registry image selection becomes immutable when a deployment references a manifest by its SHA-256 digest instead of a mutable tag. The correct option identifies the image with its digest, because ACR resolves that reference to the exact manifest even after production or latest is reassigned. Rebuilds and floating tags cannot guarantee the same build will run.

Expert Analysis

Because production must reproduce one exact image build even after a tag is reassigned, the deployment reference has to name the image's SHA-256 manifest digest rather than any mutable label.

Digest references make the ACR manifest, not its tag, the deployable identity

Azure Container Registry gives every pushed image manifest a content-derived SHA-256 digest, while a tag such as production or latest is only a pointer stored beside that manifest. The pointer can be moved with a later push; the digest cannot be made to describe a different manifest without changing its value. When the deployment image field is myregistry.azurecr.io/app@sha256:<digest>, the orchestrator is asking for one specific manifest, whose config and layer descriptors are themselves content-addressed. A subsequent build may receive the same tag, but it receives a new digest and therefore does not displace the digest already written into the production deployment. This is the decisive property for reproducibility: the deployment is not tracking a name whose meaning can change, it is naming the artifact. Two operational details follow. First, the digest must be captured from the build or registry output and promoted through environments, not retyped from a tag page. Second, retention and untagging policies must not purge that manifest; if it is deleted, a pull by digest fails instead of silently substituting a newer image. Failure is preferable to undetected drift, but availability still requires retaining or locking the manifest for as long as production must reproduce it.

Pull-time resolution decides whether a tag alias or a manifest digest is fetched

The chosen control takes effect at the moment the container runtime resolves the image reference, not when the deployment YAML is edited. A reference carrying a tag sends the registry a name lookup: ACR finds the tag's current manifest and returns it, so changing the tag changes what a later pod or node pulls. A reference containing @sha256: bypasses that indirection. The runtime sends the digest-qualified name, the registry verifies that the stored manifest matches the requested digest, and it returns the matching manifest; no tag mapping is consulted. Kubernetes then records the resolved image identity in the pod status, and restarts, rescheduling, or imagePullPolicy: Always on that digest-qualified spec still request the same manifest. This is why digest pinning survives tag changes without any admission controller, rebuild job, or deployment freeze. The digest does not hash the running container's writable layer or a local image cache; it identifies the registry manifest and, through its descriptors, the config and immutable layers. A node may already have those layers cached, or may pull them again, but it cannot satisfy the request with a different manifest. The point of enforcement is therefore the image string in the workload template and every template derived from it.

Production tags, nightly rebuilds, and latest each leave a substitution path open

Option A uses a production tag as if the word carried a guarantee; it does not. ACR resolves the tag at pull time, so any push with sufficient permission can repoint it, and the deployment can start a different build without a manifest edit. The cost is silent drift plus a dependency on registry permissions and release discipline that the digest does not need. Option B schedules nightly rebuilds, which adds build minutes and registry storage but does not freeze the deployed artifact. A rebuild may pick up a changed base image, refreshed package versions, or different build metadata, producing a new manifest and digest; even a reproducible rebuild is only useful if the resulting digest is the thing deployed. The cost is churn and an appearance of control while the deployment still follows a tag. Option C deploys latest, the most fragile alias in the set. It is overwritten by ordinary pushes, commonly paired with an always-pull policy that forces re-resolution, and it destroys straightforward rollback because the name no longer identifies a single build. Its cost is the widest exposure to unintended change. None of these options changes the underlying reference from an alias to content-addressed identity, so none satisfies the exact-build requirement on its own.

Enforced tag immutability is the alternative's only route, and it is not established here

Option A would become defensible only if the registry enforced a write-once production tag, no privileged identity could remove that protection, and deployment verification checked the resolved digest against an approved value. In that narrow design the tag would behave as a stable name, but the guarantee would come from registry policy and admission control, not from the tag itself. No such lock, approval gate, or statement that the tag has never been overwritten is present; the requirement instead demands correct selection even when tags are changed later. A tag lock tries to prevent a change, whereas a digest reference remains correct after a change has already happened elsewhere. Even with tag immutability, the alias is still an extra lookup whose meaning depends on the registry's current policy, while @sha256: is intrinsic to the manifest and can be compared directly in a deployment manifest or audit record. Option B would similarly become viable only under bit-for-bit reproducible builds whose output digest is captured and pinned before deployment, which is effectively digest pinning plus a rebuild. Option C has no policy that makes latest a stable identity. The unmet condition is enforced, auditable tag immutability; absent it, A cannot carry the requirement.

Official Reference

https://github.com/opencontainers/image-spec/blob/main/descriptor.md

This link opens the official vendor documentation in a new tab.

Exam Strategy

When an item contrasts tags with digests, first decide whether the requirement is convenience or reproducibility. If it says same build, immutable, rollback, or audit, choose the SHA-256 digest reference and reject latest, production tags, and rebuild schedules. In ACR and Kubernetes manifests, scan for @sha256:; that is the reproducibility signal. Treat tag immutability as a policy control only when the stem explicitly confirms it is enforced.

Practice All AI-200 Questions

Access 69 questions with complete answers and detailed explanations.

View Full AI-200 Practice Test →

← Back to AI-200 Study Guide