Gallery › Kubernetes › Azure built-in policies
Azure Kubernetes Service Clusters should disable Command Invoke
Converted Policy Audit Disabled Mode Indexed Version 1.0.1
Disabling command invoke can enhance the security by avoiding bypass of restricted network access or Kubernetes role-based access control
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAKS_DisableRunCommand_Audit.json · 50 lines
{
"properties": {
"policyType": "BuiltIn",
"displayName": "Azure Kubernetes Service Clusters should disable Command Invoke",
"description": "Disabling command invoke can enhance the security by avoiding bypass of restricted network access or Kubernetes role-based access control",
"metadata": {
"version": "1.0.1",
"category": "Kubernetes"
},
"version": "1.0.1",
"mode": "Indexed",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy.",
"portalReview": true
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ContainerService/managedClusters"
},
{
"field": "Microsoft.ContainerService/managedClusters/apiServerAccessProfile.disableRunCommand",
"notEquals": true
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/89f2d532-c53c-4f8f-9afa-4927b1114a0d",
"name": "89f2d532-c53c-4f8f-9afa-4927b1114a0d"
}Bylaw89f2d532-c53c-4f8f-9afa-4927b1114a0d.bylaw.ps1 · 29 lines
# Converted from AKS_DisableRunCommand_Audit.json by ConvertTo-Bylaw.
Policy '89f2d532-c53c-4f8f-9afa-4927b1114a0d' {
Properties @{
DisplayName = 'Azure Kubernetes Service Clusters should disable Command Invoke'
Description = 'Disabling command invoke can enhance the security by avoiding bypass of restricted network access or Kubernetes role-based access control'
Version = '1.0.1'
Category = 'Kubernetes'
PolicyVersion = '1.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy.'
Metadata = [ordered]@{ portalReview = $true }
}
Resource 'Microsoft.ContainerService/managedClusters' {
Require 'apiServerAccessProfile.disableRunCommand is true' {
Field apiServerAccessProfile.disableRunCommand | Must -Be $true
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Kubernetes/AKS_DisableRunCommand_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw