Resolved

AKS cluster creation fails with disableLocalAccounts error in Kubernetes 1.25

AKS
Kubernetes
Azure AD
Security
DevOps
Terraform
RBAC
Authentication

AKS cluster creation fails with BadRequest when `local_account_disabled = true` without Azure AD integration in Kubernetes 1.25+ | Error requires Azure AD for local account disablement

Issue

An Azure Kubernetes Service (AKS) cluster failed to create due to a security constraint introduced in Kubernetes 1.25+. The configuration attempted to disable local accounts (certificate-based authentication) without enabling Azure AD integration, resulting in a deployment error. This requirement enforces stricter security by mandating centralized identity management for clusters running Kubernetes 1.25 or later.

Culprit

The issue arose because Kubernetes 1.25+ requires Azure AD integration when disabling local accounts. Local accounts provide certificate-based authentication without centralized identity management, while Azure AD integration enforces Multi-Factor Authentication (MFA), Role-Based Access Control (RBAC), and centralized auditing. The configuration lacked the necessary Azure AD integration settings, violating the new Kubernetes security constraint.

Solution

For Production Environments

  • Enabled Azure AD integration to comply with Kubernetes security requirements.
  • Configured RBAC for centralized identity management, enforcing MFA and granular access controls.
  • Disabled local accounts to ensure all access is managed through Azure AD.

For Non-Production Environments

  • Kept local accounts enabled to allow certificate-based access for simplicity.
  • Acknowledged the security trade-off: Lack of MFA and centralized identity management.

Verification

After updating the configuration, the cluster deployed successfully. Access methods diverged:

  • With Azure AD: Required authentication via centralized identity management (e.g., MFA, RBAC).
  • With local accounts: Allowed direct access via certificate-based authentication.

This solution ensures compliance with Kubernetes security best practices for production environments while providing flexibility for development scenarios.