Skip to main content

More Info:

Restrict the AKS clusters access to Azure Container Registry to read-only (pull) so the cluster cannot push or modify images.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS AKS

Triage and Remediation

Remediation

Manual Steps

  1. Identify how AKS pulls images from ACR
    • On any machine with Azure CLI and access to the subscription, list the cluster and its node resource group:
    • Determine whether you are using:
      • Managed identity (system-assigned or user-assigned) attached to the AKS cluster, or
      • A service principal, or
      • ACR firewall + private endpoint only (no identity/RBAC link).
  2. Enumerate ACR instances and check role assignments
    • List ACRs in the subscription:
    • For each ACR, list role assignments relevant to AKS (replace <ACR_NAME>):
    • In the output, look for assignments to:
      • The AKS managed identity (object/principal ID from step 1), or
      • The AKS service principal.
    • Note roles such as AcrPull (read-only) vs broader ones (AcrPush, Owner, Contributor, AcrImageSigner, custom roles that include write/delete actions).
  3. Decide required access and plan corrections
    • For each identity used by AKS:
      • If only image pulling is required, the desired role is AcrPull at the minimal required scope (ideally the specific ACR, not subscription or resource group).
      • If broader roles are in use, confirm whether any workload or pipeline actually needs push/delete/sign operations from inside the cluster; if so, limit that to a separate identity not bound to the entire cluster where possible.
  4. Restrict existing over-privileged role assignments
    • For each over-privileged assignment (example: AcrPush, Contributor, Owner for the AKS identity on ACR), remove it:
    • From the JSON, copy the id of the specific assignment to remove, then:
    • If the cluster still needs pull access and has no AcrPull assignment, add it:
  5. Review other access paths to ACR (optional but recommended)
    • Check subscription- or resource-group-level assignments that might indirectly grant write access to ACR:
    • If you find higher-scope roles that include ACR write/delete actions and are not strictly required, plan to replace them with more granular, read-only assignments where feasible.
  6. Verify effective read-only configuration
    • For each ACR used by the cluster, confirm only AcrPull (or other strictly read-only custom roles you have vetted) are assigned to the AKS identity at the ACR scope:
    • Independently verify that push/delete is no longer allowed from the cluster identity by attempting a test push using that identity’s context from a non-production environment, ensuring it fails while pulls still succeed.
kubectl cannot change Azure Container Registry permissions or the AKS-to-ACR integration; those settings are managed in Azure (portal/CLI/IaC) at the cloud provider/control plane level. Refer to the Manual Steps section for how to review and adjust AKS access to ACR to be read-only (pull).