Gallery › Security Center › Azure built-in policies
[Preview]: Deploy Microsoft Defender for Endpoint agent on Windows Azure Arc machines
Converted Policy AuditIfNotExists DeployIfNotExists Disabled Mode Indexed Version 2.0.1-preview Preview
Deploys Microsoft Defender for Endpoint on Windows Azure Arc machines.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONASC_MicrosoftDefenderForEndpoint_WindowsAgent_ARC_DINE.json · 159 lines
{
"properties": {
"displayName": "[Preview]: Deploy Microsoft Defender for Endpoint agent on Windows Azure Arc machines",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Deploys Microsoft Defender for Endpoint on Windows Azure Arc machines.",
"metadata": {
"category": "Security Center",
"version": "2.0.1-preview",
"preview": true
},
"version": "2.0.1-preview",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"DeployIfNotExists",
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/machines/osName",
"like": "windows*"
},
{
"field": "tags['MDFCSecurityConnector']",
"notEquals": "true"
},
{
"anyOf": [
{
"field": "Microsoft.HybridCompute/machines/osSku",
"contains": "2012"
},
{
"field": "Microsoft.HybridCompute/machines/osSku",
"contains": "2016"
},
{
"field": "Microsoft.HybridCompute/machines/osSku",
"contains": "2019"
},
{
"field": "Microsoft.HybridCompute/machines/osSku",
"contains": "2022"
},
{
"field": "Microsoft.HybridCompute/machines/osSku",
"equals": "Windows 10 Enterprise multi-session"
},
{
"field": "Microsoft.HybridCompute/machines/osSku",
"equals": "Windows 10 Enterprise for Virtual Desktops"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
],
"type": "Microsoft.HybridCompute/machines/extensions",
"name": "MDE.Windows",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.HybridCompute/machines/extensions/publisher",
"equals": "Microsoft.Azure.AzureDefenderForServers"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/type",
"equals": "MDE.Windows"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/provisioningState",
"equals": "Succeeded"
}
]
},
"deployment": {
"properties": {
"mode": "incremental",
"parameters": {
"vmName": {
"value": "[field('name')]"
},
"location": {
"value": "[field('location')]"
},
"azureResourceId": {
"value": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.HybridCompute/machines/',field('name'))]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"azureResourceId": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2019-12-12",
"name": "[concat(parameters('vmName'), '/MDE.Windows')]",
"type": "Microsoft.HybridCompute/machines/extensions",
"location": "[parameters('location')]",
"properties": {
"autoUpgradeMinorVersion": true,
"publisher": "Microsoft.Azure.AzureDefenderForServers",
"type": "MDE.Windows",
"typeHandlerVersion": "1.0",
"settings": {
"azureResourceId": "[parameters('azureResourceId')]",
"vNextEnabled": "true",
"installedBy": "Policy"
},
"protectedSettings": {
"defenderForEndpointOnboardingScript": "[reference(subscriptionResourceId('Microsoft.Security/mdeOnboardings', 'Windows'), '2021-10-01-preview', 'full').properties.onboardingPackageWindows]"
}
}
}
]
}
}
}
}
}
},
"versions": [
"2.0.1-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/37c043a6-6d64-656d-6465-b362dfeb354a",
"name": "37c043a6-6d64-656d-6465-b362dfeb354a"
}Bylaw37c043a6-6d64-656d-6465-b362dfeb354a.bylaw.ps1 · 65 lines
# Converted from ASC_MicrosoftDefenderForEndpoint_WindowsAgent_ARC_DINE.json by ConvertTo-Bylaw.
Policy '37c043a6-6d64-656d-6465-b362dfeb354a' {
Properties @{
DisplayName = '[Preview]: Deploy Microsoft Defender for Endpoint agent on Windows Azure Arc machines'
Description = 'Deploys Microsoft Defender for Endpoint on Windows Azure Arc machines.'
Category = 'Security Center'
Version = '2.0.1-preview'
Preview = $true
PolicyVersion = '2.0.1-preview'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('DeployIfNotExists', 'AuditIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.HybridCompute/machines' {
When {
Field osName | Must -BeLike 'windows*'
Tag MDFCSecurityConnector | Must -Not -Be 'true'
}
Require 'osSku does not contain 2012' {
Field osSku | Must -Not -ContainText '2012' -IfPresent
}
Require 'osSku does not contain 2016' {
Field osSku | Must -Not -ContainText '2016' -IfPresent
}
Require 'osSku does not contain 2019' {
Field osSku | Must -Not -ContainText '2019' -IfPresent
}
Require 'osSku does not contain 2022' {
Field osSku | Must -Not -ContainText '2022' -IfPresent
}
Require 'osSku is not Windows 10 Enterprise multi-session' {
Field osSku | Must -Not -Be 'Windows 10 Enterprise multi-session' -IfPresent
}
Require 'osSku is not Windows 10 Enterprise for Virtual Desktops' {
Field osSku | Must -Not -Be 'Windows 10 Enterprise for Virtual Desktops' -IfPresent
}
}
DeployIfNotExists 'Microsoft.HybridCompute/machines/extensions' -Role 'Contributor' -Name 'MDE.Windows' -Effect (Param Effect) {
Require 'publisher, type and provisioningState are as required' {
Field publisher | Must -Be 'Microsoft.Azure.AzureDefenderForServers'
Field 'Microsoft.HybridCompute/machines/extensions/type' | Must -Be 'MDE.Windows'
Field provisioningState | Must -Be 'Succeeded'
}
Deployment -TemplateFile './templates/37c043a6-6d64-656d-6465-b362dfeb354a.json' -Parameters ([ordered]@{
vmName = (Arm '[field(''name'')]')
location = (Arm '[field(''location'')]')
azureResourceId = (Arm '[concat(''/subscriptions/'', subscription().subscriptionId, ''/resourceGroups/'', resourceGroup().name, ''/providers/Microsoft.HybridCompute/machines/'',field(''name''))]')
})
}
}Its deployment templates are written beside it:
templates/37c043a6-6d64-656d-6465-b362dfeb354a.json
Source: built-in-policies/policyDefinitions/Security Center/ASC_MicrosoftDefenderForEndpoint_WindowsAgent_ARC_DINE.json in Azure/azure-policy, under the MIT licence.
Bylaw