Gallery › Security Center › Azure built-in policies
Configure Microsoft Defender for Containers to be enabled
Converted Policy DeployIfNotExists Disabled Mode All Version 1.0.1
Microsoft Defender for Containers provides hardening, vulnerability assessment and run-time protections for your Azure, hybrid, and multi-cloud Kubernetes environments.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONASC_Azure_Defender_Containers_DINE.json · 78 lines
{
"properties": {
"displayName": "Configure Microsoft Defender for Containers to be enabled",
"policyType": "BuiltIn",
"mode": "All",
"description": "Microsoft Defender for Containers provides hardening, vulnerability assessment and run-time protections for your Azure, hybrid, and multi-cloud Kubernetes environments.",
"metadata": {
"version": "1.0.1",
"category": "Security Center"
},
"version": "1.0.1",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "DeployIfNotExists",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"DeployIfNotExists",
"Disabled"
]
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Resources/subscriptions"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Security/pricings",
"name": "Containers",
"deploymentScope": "subscription",
"existenceScope": "subscription",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/fb1c8493-542b-48eb-b624-b4c8fea62acd"
],
"existenceCondition": {
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "Standard"
},
"deployment": {
"location": "westeurope",
"properties": {
"mode": "incremental",
"parameters": {},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2023-01-01",
"name": "Containers",
"properties": {
"pricingTier": "Standard"
}
}
],
"outputs": {}
}
}
}
}
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/c9ddb292-b203-4738-aead-18e2716e858f",
"name": "c9ddb292-b203-4738-aead-18e2716e858f"
}Bylawc9ddb292-b203-4738-aead-18e2716e858f.bylaw.ps1 · 33 lines
# Converted from ASC_Azure_Defender_Containers_DINE.json by ConvertTo-Bylaw.
Policy 'c9ddb292-b203-4738-aead-18e2716e858f' {
Properties @{
DisplayName = 'Configure Microsoft Defender for Containers to be enabled'
Description = 'Microsoft Defender for Containers provides hardening, vulnerability assessment and run-time protections for your Azure, hybrid, and multi-cloud Kubernetes environments.'
Version = '1.0.1'
Category = 'Security Center'
PolicyVersion = '1.0.1'
Mode = 'All'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Resources/subscriptions'
DeployIfNotExists 'Microsoft.Security/pricings' -Role 'Security Admin' -Name 'Containers' -ExistenceScope Subscription -Effect (Param Effect) {
Require 'pricingTier is Standard' {
Field pricingTier | Must -Be 'Standard'
}
Deployment @{
TemplateFile = './templates/c9ddb292-b203-4738-aead-18e2716e858f.json'
Scope = 'Subscription'
Location = 'westeurope'
}
}
}Its deployment templates are written beside it:
templates/c9ddb292-b203-4738-aead-18e2716e858f.json
Source: built-in-policies/policyDefinitions/Security Center/ASC_Azure_Defender_Containers_DINE.json in Azure/azure-policy, under the MIT licence.
Bylaw