Gallery › Security Center › Azure built-in policies
Configure Microsoft Defender for Servers P1 plan
Converted Policy DeployIfNotExists Disabled Mode All Version 1.0.0
Configures Microsoft Defender for Servers with Plan P1. Agentless VM Scanning is not supported for P1 and is excluded from this policy.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONASC_Azure_Defender_Servers_P1_Features_DINE.json · 129 lines
{
"properties": {
"displayName": "Configure Microsoft Defender for Servers P1 plan",
"policyType": "BuiltIn",
"mode": "All",
"description": "Configures Microsoft Defender for Servers with Plan P1. Agentless VM Scanning is not supported for P1 and is excluded from this policy.",
"metadata": {
"version": "1.0.0",
"category": "Security Center"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "DeployIfNotExists",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"DeployIfNotExists",
"Disabled"
]
},
"isMdeDesignatedSubscriptionEnabled": {
"type": "String",
"metadata": {
"displayName": "MDE Designated Subscription Enabled",
"description": "Enable or disable the MDE Designated Subscription add-on feature"
},
"allowedValues": [
"true",
"false"
],
"defaultValue": "false"
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Resources/subscriptions"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Security/pricings",
"name": "VirtualMachines",
"deploymentScope": "subscription",
"existenceScope": "subscription",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635"
],
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "Standard"
},
{
"field": "Microsoft.Security/pricings/subPlan",
"equals": "P1"
},
{
"count": {
"field": "Microsoft.Security/pricings/extensions[*]",
"where": {
"allOf": [
{
"field": "Microsoft.Security/pricings/extensions[*].name",
"equals": "MdeDesignatedSubscription"
},
{
"field": "Microsoft.Security/pricings/extensions[*].isEnabled",
"equals": "[parameters('isMdeDesignatedSubscriptionEnabled')]"
}
]
}
},
"equals": 1
}
]
},
"deployment": {
"location": "westeurope",
"properties": {
"mode": "incremental",
"parameters": {
"isMdeDesignatedSubscriptionEnabled": {
"value": "[parameters('isMdeDesignatedSubscriptionEnabled')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"isMdeDesignatedSubscriptionEnabled": {
"type": "String"
}
},
"resources": [
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2023-01-01",
"name": "VirtualMachines",
"properties": {
"pricingTier": "Standard",
"subPlan": "P1",
"extensions": [
{
"name": "MdeDesignatedSubscription",
"isEnabled": "[parameters('isMdeDesignatedSubscriptionEnabled')]"
}
]
}
}
]
}
}
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/cbeb9ea0-0ab8-4545-8b32-6dbac33b0e16",
"name": "cbeb9ea0-0ab8-4545-8b32-6dbac33b0e16"
}Bylawcbeb9ea0-0ab8-4545-8b32-6dbac33b0e16.bylaw.ps1 · 46 lines
# Converted from ASC_Azure_Defender_Servers_P1_Features_DINE.json by ConvertTo-Bylaw.
Policy 'cbeb9ea0-0ab8-4545-8b32-6dbac33b0e16' {
Properties @{
DisplayName = 'Configure Microsoft Defender for Servers P1 plan'
Description = 'Configures Microsoft Defender for Servers with Plan P1. Agentless VM Scanning is not supported for P1 and is excluded from this policy.'
Version = '1.0.0'
Category = 'Security Center'
PolicyVersion = '1.0.0'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter IsMdeDesignatedSubscriptionEnabled @{
AllowedValues = @('true', 'false')
Default = 'false'
DisplayName = 'MDE Designated Subscription Enabled'
Description = 'Enable or disable the MDE Designated Subscription add-on feature'
}
Resource 'Microsoft.Resources/subscriptions'
DeployIfNotExists 'Microsoft.Security/pricings' -Role 'Owner' -Name 'VirtualMachines' -ExistenceScope Subscription -Effect (Param Effect) {
Require 'pricingTier, subPlan, extensions and 2 more are as required' {
Field pricingTier | Must -Be 'Standard'
Field subPlan | Must -Be 'P1'
Count 'extensions[*]' -Where {
Field name | Must -Be 'MdeDesignatedSubscription'
Field isEnabled | Must -Be (Param IsMdeDesignatedSubscriptionEnabled)
} | Must -Be 1
}
Deployment @{
TemplateFile = './templates/cbeb9ea0-0ab8-4545-8b32-6dbac33b0e16.json'
Scope = 'Subscription'
Location = 'westeurope'
Parameters = [ordered]@{
isMdeDesignatedSubscriptionEnabled = (Param IsMdeDesignatedSubscriptionEnabled)
}
}
}
}Its deployment templates are written beside it:
templates/cbeb9ea0-0ab8-4545-8b32-6dbac33b0e16.json
Source: built-in-policies/policyDefinitions/Security Center/ASC_Azure_Defender_Servers_P1_Features_DINE.json in Azure/azure-policy, under the MIT licence.
Bylaw