Skip to main content

More Info:

Use dedicated service accounts integrated with Azure Active Directory so users and groups get scoped, auditable access to Kubernetes resources instead of shared or default identities.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS AKS

Triage and Remediation

Remediation

Manual Steps

  1. Determine whether the AKS cluster is Azure AD–integrated
    • Run on any machine with Azure CLI access:
    • Review the output: confirm that either a legacy aadProfile is configured or oidcIssuerProfile.enabled is true. If neither is present, plan to enable Azure AD / OIDC integration as per your organization’s standards before proceeding.
  2. Inventory who is accessing the cluster and how (AAD users/groups vs. shared identities)
    • List Azure AD app registrations and service principals used for AKS access (run from any machine with Azure AD Graph/MS Graph permissions):
    • Correlate these identities with:
      • The AKS cluster’s managed identity or service principals (identity, servicePrincipalProfile fields from az aks show).
      • Any identities configured in your IaC (ARM/Bicep/Terraform) for cluster access.
    • Decide which of these identities represent shared/broadly used accounts that should not have direct, unscoped access.
  3. Review RBAC bindings to ensure use of scoped service accounts and AAD groups, not defaults/shared identities
    • Get current role bindings and cluster role bindings (any machine with kubectl access):
    • For more detail on subjects:
    • Manually inspect subjects and look for:
      • system:anonymous, system:unauthenticated, or system:masters.
      • system:serviceaccount:default:default or other default service accounts used for application workloads.
      • Broad Azure AD groups or generic service principals instead of dedicated, least-privilege identities.
    • Decide which bindings should be refactored to:
      • Dedicated Kubernetes service accounts per application or component.
      • Azure AD groups mapped to appropriate ClusterRoles/Roles for human users.
  4. Check whether workloads use dedicated Kubernetes service accounts vs. defaults
    • List service accounts by namespace (any machine with kubectl access):
    • Inspect pods to see which service accounts they use:
    • Identify applications using default or other shared service accounts instead of dedicated ones. Decide which namespaces/workloads require creation and use of dedicated service accounts and corresponding Role/RoleBindings.
  5. Define and implement the desired model for dedicated AKS service accounts and AAD integration (via console/CLI/IaC)
    • Using Azure Portal, Azure CLI, or your IaC:
      • Ensure the cluster is configured to use Azure AD (managed AAD/OIDC) per step 1 if your policy requires it.
      • Create or update Azure AD groups to represent roles (e.g., aks-dev-readonly, aks-ops-admin) and assign the appropriate users.
      • In your Kubernetes manifests/IaC, define:
        • Dedicated ServiceAccount objects per application or CI/CD component.
        • Role/ClusterRole and RoleBinding/ClusterRoleBinding objects that bind those service accounts and AAD groups with least-privilege access.
    • This step is done through Azure Portal/CLI/IaC authoring; there is no single command that can generically “fix” the cluster because choices are organization- and workload-specific.
  6. Verify that access is now via dedicated service accounts and AAD identities, and not via shared/default identities
    • Re-run:
    • Confirm that:
      • Human access is mediated through Azure AD users/groups mapped to appropriate RBAC roles.
      • Application workloads use named, dedicated service accounts instead of default or shared accounts.
      • Any previously identified broad/shared or default identities have been removed or re-scoped according to your access model.
kubectl can’t configure Azure AD integration or how identities are mapped to AKS; those settings are managed in Azure (portal/CLI/IaC) at the managed control plane level. To address this finding, use Azure AD and AKS configuration as described in the Manual Steps section rather than attempting changes with kubectl.