Gallery › Kubernetes service › Azure built-in policies
[Deprecated]: Ensure only allowed container images in AKS
Doesn't convert yet Policy Disabled Mode Microsoft.ContainerService.Data Version 1.0.1-deprecated Deprecated
This policy ensures only allowed container images are running in an Azure Kubernetes Service cluster. This policy is deprecated, please visit https://aka.ms/kubepolicydoc for instructions on using new Kubernetes policies.
ConvertTo-Bylaw can't convert this policy yet:
- BYL6002 Its mode, Microsoft.ContainerService.Data, is a resource provider mode, which language version 1.0 doesn't support.
Azure Policy JSONContainerAllowedImages_EnforceRegoPolicy.json · 56 lines
{
"properties": {
"displayName": "[Deprecated]: Ensure only allowed container images in AKS",
"policyType": "BuiltIn",
"mode": "Microsoft.ContainerService.Data",
"description": "This policy ensures only allowed container images are running in an Azure Kubernetes Service cluster. This policy is deprecated, please visit https://aka.ms/kubepolicydoc for instructions on using new Kubernetes policies.",
"metadata": {
"version": "1.0.1-deprecated",
"category": "Kubernetes service",
"deprecated": true
},
"version": "1.0.1",
"parameters": {
"allowedContainerImagesRegex": {
"type": "String",
"metadata": {
"displayName": "Allowed registry or registries regex",
"description": "The RegEx rule used to match allowed container image field in a Kubernetes cluster. For example, to allow any Azure Container Registry image by matching partial path: \"^[^\\/]+\\.azurecr\\.io\\/.+$\". For multiple registries: \"^([^\\/]+\\.azurecr\\.io|registry\\.io)\\/.+$\"."
}
},
"effect": {
"type": "String",
"defaultValue": "EnforceRegoPolicy",
"allowedValues": [
"EnforceRegoPolicy",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.ContainerService/managedClusters"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"policyId": "ContainerAllowedImages",
"policy": "https://raw.githubusercontent.com/Azure/azure-policy/master/built-in-references/KubernetesService/container-allowed-images/limited-preview/gatekeeperpolicy.rego",
"policyParameters": {
"allowedContainerImagesRegex": "[parameters('allowedContainerImagesRegex')]"
}
}
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/5f86cb6e-c4da-441b-807c-44bd0cc14e66",
"name": "5f86cb6e-c4da-441b-807c-44bd0cc14e66"
}Source: built-in-policies/policyDefinitions/Kubernetes service/ContainerAllowedImages_EnforceRegoPolicy.json in Azure/azure-policy, under the MIT licence.
Bylaw