For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/terraform-azure-aks-network-policy-misconfigured.md.
A documentation index is available at /llms.txt.
Azure Kubernetes Service (AKS) clusters should have a proper network policy configured using the network_profile.network_policy attribute to enforce the principle of least privilege and restrict unnecessary network traffic between pods. If this attribute is omitted or misconfigured, as shown below, it leaves the cluster vulnerable to unrestricted communication between pods, increasing the risk of lateral movement and exposure if one pod is compromised:
network_profile {
// network_policy not defined
}
A secure AKS configuration explicitly sets a network policy. For example:
network_profile {
network_policy = "azure"
}
Without strict network policies, attackers could exploit insecure inter-pod communications to access sensitive resources or escalate privileges within the Kubernetes environment.