Gallery › Kubernetes › Azure Community Policy
Ensure only allowed app armor profiles are used in Kubernetes Cluster
Doesn't convert yet Policy Audit Deny Disabled Mode Microsoft.Kubernetes.Data Version 1.0.0 Preview
This policy ensures containers define an App Armor profile and only use allowed App Armor profiles. For instructions on using this policy, please visit https://aka.ms/kubepolicydoc.
ConvertTo-Bylaw can't convert this policy yet:
- BYL6002 Its mode, Microsoft.Kubernetes.Data, is a resource provider mode, which language version 1.0 doesn't support.
Azure Policy JSONazurepolicy.json · 70 lines
{
"properties": {
"displayName": "Ensure only allowed app armor profiles are used in Kubernetes Cluster",
"policyType": "Custom",
"mode": "Microsoft.Kubernetes.Data",
"description": "This policy ensures containers define an App Armor profile and only use allowed App Armor profiles. For instructions on using this policy, please visit https://aka.ms/kubepolicydoc.",
"metadata": {
"version": "1.0.0",
"category": "Kubernetes",
"preview": true
},
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
},
"excludedNamespaces": {
"type": "Array",
"metadata": {
"displayName": "Namespace exclusions",
"description": "List of Kubernetes namespaces to exclude from policy evaluation. Providing a value for this parameter is optional."
},
"defaultValue": [
"kube-system",
"gatekeeper-system",
"azure-arc"
]
},
"allowedProfiles": {
"type": "Array",
"metadata": {
"displayName": "Allowed App Armor profiles",
"description": "List of valid App Armor profiles. E.g. runtime/default. For more information on App Armor, please refer https://aka.ms/k8s-app-armor"
}
}
},
"policyRule": {
"if": {
"field": "type",
"in": [
"AKS Engine",
"Microsoft.Kubernetes/connectedClusters",
"Microsoft.ContainerService/managedClusters"
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"constraintTemplate": "https://raw.githubusercontent.com/Azure/Community-Policy/master/policyDefinitions/Kubernetes/enforce-apparmor-profile/template.yaml",
"constraint": "https://raw.githubusercontent.com/Azure/Community-Policy/master/policyDefinitions/Kubernetes/enforce-apparmor-profile/constraint.yaml",
"values": {
"excludedNamespaces": "[parameters('excludedNamespaces')]",
"allowedProfiles": "[parameters('allowedProfiles')]"
}
}
}
}
},
"type": "Microsoft.Authorization/policyDefinitions",
"name": "1b775519-c696-4ee1-be63-304c6e908b24"
}Source: policyDefinitions/Kubernetes/enforce-apparmor-profile/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw