Gallery › Kubernetes › Azure built-in policies
Azure Policy Add-on for Kubernetes service (AKS) should be installed and enabled on your clusters
Converted Policy Audit Disabled Mode Indexed Version 1.0.2
Azure Policy Add-on for Kubernetes service (AKS) extends Gatekeeper v3, an admission controller webhook for Open Policy Agent (OPA), to apply at-scale enforcements and safeguards on your clusters in a centralized, consistent manner.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAKS_AzurePolicyAddOn_Audit.json · 57 lines
{
"properties": {
"displayName": "Azure Policy Add-on for Kubernetes service (AKS) should be installed and enabled on your clusters",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Azure Policy Add-on for Kubernetes service (AKS) extends Gatekeeper v3, an admission controller webhook for Open Policy Agent (OPA), to apply at-scale enforcements and safeguards on your clusters in a centralized, consistent manner.",
"metadata": {
"version": "1.0.2",
"category": "Kubernetes"
},
"version": "1.0.2",
"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"
},
{
"anyOf": [
{
"field": "Microsoft.ContainerService/managedClusters/addonProfiles.azurePolicy.enabled",
"exists": "false"
},
{
"field": "Microsoft.ContainerService/managedClusters/addonProfiles.azurePolicy.enabled",
"equals": "false"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.2"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/0a15ec92-a229-4763-bb14-0ea34a568f8d",
"name": "0a15ec92-a229-4763-bb14-0ea34a568f8d"
}Bylaw0a15ec92-a229-4763-bb14-0ea34a568f8d.bylaw.ps1 · 32 lines
# Converted from AKS_AzurePolicyAddOn_Audit.json by ConvertTo-Bylaw.
Policy '0a15ec92-a229-4763-bb14-0ea34a568f8d' {
Properties @{
DisplayName = 'Azure Policy Add-on for Kubernetes service (AKS) should be installed and enabled on your clusters'
Description = 'Azure Policy Add-on for Kubernetes service (AKS) extends Gatekeeper v3, an admission controller webhook for Open Policy Agent (OPA), to apply at-scale enforcements and safeguards on your clusters in a centralized, consistent manner.'
Version = '1.0.2'
Category = 'Kubernetes'
PolicyVersion = '1.0.2'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.ContainerService/managedClusters' {
Require 'addonProfiles.azurePolicy.enabled exists' {
Field addonProfiles.azurePolicy.enabled | Must -Exist
}
Require 'addonProfiles.azurePolicy.enabled is not false' {
Field addonProfiles.azurePolicy.enabled | Must -Not -Be 'false' -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Kubernetes/AKS_AzurePolicyAddOn_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw