For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/ansible-azure-aks-rbac-disabled.md.
A documentation index is available at /llms.txt.
AKS clusters must have role-based access control (RBAC) enabled to restrict Kubernetes API operations to authorized principals and prevent privilege escalation or unauthorized cluster modifications.
In Ansible playbooks, tasks using the azure.azcollection.azure_rm_aks or azure_rm_aks modules must define the enable_rbac property and set it to a truthy value (for example yes/true or YAML true). Resources with enable_rbac missing or not set to a truthy value are flagged as insecure.
Secure Ansible example:
- name:Create AKS cluster with RBAC enabledazure.azcollection.azure_rm_aks:name:myAKSresource_group:myRGenable_rbac:yes
Compliant Code Examples
- name:Create an AKS instance v3azure_rm_aks:name:myAKSresource_group:myResourceGrouplocation:eastusdns_prefix:akstestkubernetes_version:1.14.6linux_profile:admin_username:azureuserssh_key:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA...service_principal:client_id:cf72ca99-f6b9-4004-b0e0-bee10c521948client_secret:Password1234!agent_pool_profiles:- name:defaultcount:1vm_size:Standard_DS1_v2type:VirtualMachineScaleSetsmax_count:3min_count:1enable_rbac:yes
Non-Compliant Code Examples
- name:Create an AKS instanceazure_rm_aks:name:myAKSresource_group:myResourceGrouplocation:eastusdns_prefix:akstestkubernetes_version:1.14.6linux_profile:admin_username:azureuserssh_key:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA...service_principal:client_id:"cf72ca99-f6b9-4004-b0e0-bee10c521948"client_secret:"Password1234!"agent_pool_profiles:- name:defaultcount:1vm_size:Standard_DS1_v2type:VirtualMachineScaleSetsmax_count:3min_count:1enable_rbac:no- name:Create an AKS instance v2azure_rm_aks:name:myAKSresource_group:myResourceGrouplocation:eastusdns_prefix:akstestkubernetes_version:1.14.6linux_profile:admin_username:azureuserssh_key:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA...service_principal:client_id:"cf72ca99-f6b9-4004-b0e0-bee10c521948"client_secret:"Password1234!"agent_pool_profiles:- name:defaultcount:1vm_size:Standard_DS1_v2type:VirtualMachineScaleSetsmax_count:3min_count:1
1
2
rulesets:- Ansible / Azure # Rules to enforce / Azure.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.