AKS RBAC is disabled

Grant users and service accounts only the Kubernetes permissions they need.

Description

Set role_based_access_control_enabled = true when creating an AKS cluster. Kubernetes roles and bindings determine the operations users, groups and service accounts can perform.

Potential impact

An unnecessary administrator binding still grants broad access after RBAC is enabled.

Remediation

Limit grants by namespace, resource and operation. Test allowed and denied actions as an ordinary user and a service account. If using Azure RBAC for AKS, also check Azure role assignments for Entra users and groups. AzureRM 5.6.0 replaces a non-RBAC cluster when enabling RBAC, so review the plan and migrate workloads and data.

Examples

Both excerpts keep the same cluster name and Azure CNI configuration. Supply the referenced resource group. To run both clusters during migration, use a separate Terraform resource and a different cluster name.

Before

hcl
resource "azurerm_kubernetes_cluster" "example" {
  name                = "example-aks1"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  dns_prefix          = "exampleaks1"

  role_based_access_control_enabled = false

  default_node_pool {
    name       = "default"
    node_count = 1
    vm_size    = "Standard_D2_v2"
  }

  identity {
    type = "SystemAssigned"
  }

  tags = {
    Environment = "Production"
  }

  network_profile {
    network_plugin = "azure"
    network_policy = "azure"
  }
}

After

hcl
resource "azurerm_kubernetes_cluster" "example" {
  name                = "example-aks1"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  dns_prefix          = "exampleaks1"

  role_based_access_control_enabled = true

  default_node_pool {
    name       = "default"
    node_count = 1
    vm_size    = "Standard_D2_v2"
  }

  identity {
    type = "SystemAssigned"
  }

  tags = {
    Environment = "Production"
  }

  network_profile {
    network_plugin = "azure"
    network_policy = "azure"
  }
}

References