Gallery › Security Center › Azure built-in policies
Configure Microsoft Defender for Servers plan
Converted Policy DeployIfNotExists Disabled Mode All Version 2.0.0
New capabilities are continuously being added to Defender for Servers, which may require the user's explicit enablement. Use this policy to make sure all new capabilities will be enabled.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONASC_Azure_Defender_Servers_Full_Features_DINE.json · 187 lines
{
"properties": {
"displayName": "Configure Microsoft Defender for Servers plan",
"policyType": "BuiltIn",
"mode": "All",
"description": "New capabilities are continuously being added to Defender for Servers, which may require the user's explicit enablement. Use this policy to make sure all new capabilities will be enabled.",
"metadata": {
"version": "2.0.0",
"category": "Security Center"
},
"version": "2.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "DeployIfNotExists",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"DeployIfNotExists",
"Disabled"
]
},
"subPlan": {
"type": "String",
"metadata": {
"displayName": "Defender for Servers plans",
"description": "Select a Defender for Servers plan"
},
"allowedValues": [
"P2"
],
"defaultValue": "P2"
},
"isAgentlessVmScanningEnabled": {
"type": "String",
"metadata": {
"displayName": "Agentless VM Scanning Enabled",
"description": "Enable or disable the Agentless VM Scanning add-on feature"
},
"allowedValues": [
"true",
"false"
],
"defaultValue": "true"
},
"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": "[parameters('subPlan')]"
},
{
"count": {
"field": "Microsoft.Security/pricings/extensions[*]",
"where": {
"allOf": [
{
"field": "Microsoft.Security/pricings/extensions[*].name",
"equals": "AgentlessVmScanning"
},
{
"field": "Microsoft.Security/pricings/extensions[*].isEnabled",
"equals": "[parameters('isAgentlessVmScanningEnabled')]"
}
]
}
},
"equals": 1
},
{
"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": {
"subPlan": {
"value": "[parameters('subPlan')]"
},
"isAgentlessVmScanningEnabled": {
"value": "[parameters('isAgentlessVmScanningEnabled')]"
},
"isMdeDesignatedSubscriptionEnabled": {
"value": "[parameters('isMdeDesignatedSubscriptionEnabled')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subPlan": {
"type": "String"
},
"isAgentlessVmScanningEnabled": {
"type": "String"
},
"isMdeDesignatedSubscriptionEnabled": {
"type": "String"
}
},
"resources": [
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2023-01-01",
"name": "VirtualMachines",
"properties": {
"pricingTier": "Standard",
"subPlan": "[parameters('subPlan')]",
"extensions": [
{
"name": "AgentlessVmScanning",
"isEnabled": "[parameters('isAgentlessVmScanningEnabled')]"
},
{
"name": "MdeDesignatedSubscription",
"isEnabled": "[parameters('isMdeDesignatedSubscriptionEnabled')]"
}
]
}
}
]
}
}
}
}
}
},
"versions": [
"2.0.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/5eb6d64a-4086-4d7a-92da-ec51aed0332d",
"name": "5eb6d64a-4086-4d7a-92da-ec51aed0332d"
}Bylaw5eb6d64a-4086-4d7a-92da-ec51aed0332d.bylaw.ps1 · 65 lines
# Converted from ASC_Azure_Defender_Servers_Full_Features_DINE.json by ConvertTo-Bylaw.
Policy '5eb6d64a-4086-4d7a-92da-ec51aed0332d' {
Properties @{
DisplayName = 'Configure Microsoft Defender for Servers plan'
Description = 'New capabilities are continuously being added to Defender for Servers, which may require the user''s explicit enablement. Use this policy to make sure all new capabilities will be enabled.'
Version = '2.0.0'
Category = 'Security Center'
PolicyVersion = '2.0.0'
Mode = 'All'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter SubPlan @{
AllowedValues = @('P2')
Default = 'P2'
DisplayName = 'Defender for Servers plans'
Description = 'Select a Defender for Servers plan'
}
Parameter IsAgentlessVmScanningEnabled @{
AllowedValues = @('true', 'false')
Default = 'true'
DisplayName = 'Agentless VM Scanning Enabled'
Description = 'Enable or disable the Agentless VM Scanning add-on feature'
}
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 (Param SubPlan)
Count 'extensions[*]' -Where {
Field name | Must -Be 'AgentlessVmScanning'
Field isEnabled | Must -Be (Param IsAgentlessVmScanningEnabled)
} | Must -Be 1
Count 'extensions[*]' -Where {
Field name | Must -Be 'MdeDesignatedSubscription'
Field isEnabled | Must -Be (Param IsMdeDesignatedSubscriptionEnabled)
} | Must -Be 1
}
Deployment @{
TemplateFile = './templates/5eb6d64a-4086-4d7a-92da-ec51aed0332d.json'
Scope = 'Subscription'
Location = 'westeurope'
Parameters = [ordered]@{
subPlan = (Param SubPlan)
isAgentlessVmScanningEnabled = (Param IsAgentlessVmScanningEnabled)
isMdeDesignatedSubscriptionEnabled = (Param IsMdeDesignatedSubscriptionEnabled)
}
}
}
}Its deployment templates are written beside it:
templates/5eb6d64a-4086-4d7a-92da-ec51aed0332d.json
Source: built-in-policies/policyDefinitions/Security Center/ASC_Azure_Defender_Servers_Full_Features_DINE.json in Azure/azure-policy, under the MIT licence.
Bylaw