Gallery › Kubernetes › Azure built-in policies
[Preview]: Azure Arc enabled Kubernetes clusters should have Microsoft Defender for Cloud extension installed
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 6.0.0-preview Preview
Microsoft Defender for Cloud extension for Azure Arc provides threat protection for your Arc enabled Kubernetes clusters. The extension collects data from all nodes in the cluster and sends it to the Azure Defender for Kubernetes backend in the cloud for further analysis. Learn more in https://docs.microsoft.com/azure/defender-for-cloud/defender-for-containers-enable?pivots=defender-for-container-arc.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "[Preview]: Azure Arc enabled Kubernetes clusters should have Microsoft Defender for Cloud extension installed",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Microsoft Defender for Cloud extension for Azure Arc provides threat protection for your Arc enabled Kubernetes clusters. The extension collects data from all nodes in the cluster and sends it to the Azure Defender for Kubernetes backend in the cloud for further analysis. Learn more in https://docs.microsoft.com/azure/defender-for-cloud/defender-for-containers-enable?pivots=defender-for-container-arc.",
"metadata": {
"version": "6.0.0-preview",
"category": "Kubernetes",
"preview": "true"
},
"version": "6.0.0-preview",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Kubernetes/connectedClusters"
},
{
"field": "Microsoft.Kubernetes/connectedClusters/distribution",
"notIn": [
"aks",
"aks_management",
"eks",
"gke"
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.KubernetesConfiguration/extensions",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.KubernetesConfiguration/extensions/extensionType",
"equals": "microsoft.azuredefender.kubernetes"
},
{
"field": "Microsoft.KubernetesConfiguration/extensions/provisioningState",
"equals": "Succeeded"
}
]
}
}
}
},
"versions": [
"6.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/8dfab9c4-fe7b-49ad-85e4-1e9be085358f",
"name": "8dfab9c4-fe7b-49ad-85e4-1e9be085358f"
}# Converted from ASC_Azure_Defender_Arc_Extension_Audit.json by ConvertTo-Bylaw.
Policy '8dfab9c4-fe7b-49ad-85e4-1e9be085358f' {
Properties @{
DisplayName = '[Preview]: Azure Arc enabled Kubernetes clusters should have Microsoft Defender for Cloud extension installed'
Description = 'Microsoft Defender for Cloud extension for Azure Arc provides threat protection for your Arc enabled Kubernetes clusters. The extension collects data from all nodes in the cluster and sends it to the Azure Defender for Kubernetes backend in the cloud for further analysis. Learn more in https://docs.microsoft.com/azure/defender-for-cloud/defender-for-containers-enable?pivots=defender-for-container-arc.'
Version = '6.0.0-preview'
Category = 'Kubernetes'
PolicyVersion = '6.0.0-preview'
Mode = 'Indexed'
Metadata = [ordered]@{ preview = 'true' }
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Kubernetes/connectedClusters' {
Require 'distribution is one of 4 values' {
Field distribution | Must -BeIn @('aks', 'aks_management', 'eks', 'gke')
}
}
AuditIfNotExists 'Microsoft.KubernetesConfiguration/extensions' -Effect (Param Effect) {
Require 'extensionType is microsoft.azuredefender.kubernetes and provisioningState is Succeeded' {
Field extensionType | Must -Be 'microsoft.azuredefender.kubernetes'
Field provisioningState | Must -Be 'Succeeded'
}
}
}Source: built-in-policies/policyDefinitions/Kubernetes/ASC_Azure_Defender_Arc_Extension_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw