Gallery › Kubernetes › Azure built-in policies
Azure Kubernetes Service clusters should have Defender profile enabled
Converted Policy Audit Disabled Mode Indexed Version 2.0.1
Microsoft Defender for Containers provides cloud-native Kubernetes security capabilities including environment hardening, workload protection, and run-time protection. When you enable the SecurityProfile.AzureDefender on your Azure Kubernetes Service cluster, an agent is deployed to your cluster to collect security event data. Learn more about Microsoft Defender for Containers in https://docs.microsoft.com/azure/defender-for-cloud/defender-for-containers-introduction?tabs=defender-for-container-arch-aks
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "Azure Kubernetes Service clusters should have Defender profile enabled",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Microsoft Defender for Containers provides cloud-native Kubernetes security capabilities including environment hardening, workload protection, and run-time protection. When you enable the SecurityProfile.AzureDefender on your Azure Kubernetes Service cluster, an agent is deployed to your cluster to collect security event data. Learn more about Microsoft Defender for Containers in https://docs.microsoft.com/azure/defender-for-cloud/defender-for-containers-introduction?tabs=defender-for-container-arch-aks",
"metadata": {
"version": "2.0.1",
"category": "Kubernetes"
},
"version": "2.0.1",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ContainerService/managedClusters"
},
{
"field": "Microsoft.ContainerService/managedClusters/securityProfile.defender.securityMonitoring.enabled",
"notEquals": true
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"2.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/a1840de2-8088-4ea8-b153-b4c723e9cb01",
"name": "a1840de2-8088-4ea8-b153-b4c723e9cb01"
}# Converted from ASC_Azure_Defender_AKS_SecurityProfile_Audit.json by ConvertTo-Bylaw.
Policy 'a1840de2-8088-4ea8-b153-b4c723e9cb01' {
Properties @{
DisplayName = 'Azure Kubernetes Service clusters should have Defender profile enabled'
Description = 'Microsoft Defender for Containers provides cloud-native Kubernetes security capabilities including environment hardening, workload protection, and run-time protection. When you enable the SecurityProfile.AzureDefender on your Azure Kubernetes Service cluster, an agent is deployed to your cluster to collect security event data. Learn more about Microsoft Defender for Containers in https://docs.microsoft.com/azure/defender-for-cloud/defender-for-containers-introduction?tabs=defender-for-container-arch-aks'
Version = '2.0.1'
Category = 'Kubernetes'
PolicyVersion = '2.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.ContainerService/managedClusters' {
Require 'securityProfile.defender.securityMonitoring.enabled is true' {
Field securityProfile.defender.securityMonitoring.enabled | Must -Be $true
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Kubernetes/ASC_Azure_Defender_AKS_SecurityProfile_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw