Gallery › Security Center › Azure built-in policies
[Deprecated]: Configure Association to link virtual machines to user-defined Microsoft Defender for Cloud Data Collection Rule
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 2.0.1-deprecated Deprecated
This policy is deprecated as part of Microsoft Defender for Cloud updated strategy. As part of this strategy, Azure Monitor agent is no longer required to receive Defender for Servers security features, but is required for Defender for SQL Server on machines. For more information visit: https://aka.ms/MdcAgentStrategy. Configure machines to automatically create an association with the user-defined data collection rule for Microsoft Defender for Cloud.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "[Deprecated]: Configure Association to link virtual machines to user-defined Microsoft Defender for Cloud Data Collection Rule",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy is deprecated as part of Microsoft Defender for Cloud updated strategy. As part of this strategy, Azure Monitor agent is no longer required to receive Defender for Servers security features, but is required for Defender for SQL Server on machines. For more information visit: https://aka.ms/MdcAgentStrategy. Configure machines to automatically create an association with the user-defined data collection rule for Microsoft Defender for Cloud.",
"metadata": {
"category": "Security Center",
"version": "2.0.1-deprecated",
"deprecated": true
},
"version": "2.0.1",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "DeployIfNotExists",
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
},
"workspaceRegion": {
"type": "String",
"metadata": {
"displayName": "Workspace region",
"description": "Region of the Workspace to which the virtual machines in scope will send their logs. Needed to create the Data Collection Rule in the same region",
"strongType": "location"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
},
{
"field": "location",
"in": [
"australiacentral",
"australiaeast",
"australiasoutheast",
"brazilsouth",
"canadacentral",
"canadaeast",
"centralindia",
"centralus",
"eastasia",
"eastus2euap",
"eastus",
"eastus2",
"francecentral",
"germanywestcentral",
"japaneast",
"japanwest",
"jioindiawest",
"koreacentral",
"koreasouth",
"northcentralus",
"northeurope",
"norwayeast",
"southafricanorth",
"southcentralus",
"southeastasia",
"southindia",
"switzerlandnorth",
"uaenorth",
"uksouth",
"ukwest",
"westcentralus",
"westeurope",
"westindia",
"westus",
"westus2"
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Insights/dataCollectionRuleAssociations",
"name": "Security-RulesAssociation",
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/749f88d5-cbae-40b8-bcfc-e573ddc772fa",
"/providers/microsoft.authorization/roleDefinitions/92aaf0da-9dab-42b6-94a3-d43ce8d16293"
],
"deployment": {
"properties": {
"mode": "incremental",
"parameters": {
"resourceGroup": {
"value": "[resourceGroup().name]"
},
"vmName": {
"value": "[field('name')]"
},
"workspaceRegion": {
"value": "[parameters('workspaceRegion')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroup": {
"type": "string"
},
"vmName": {
"type": "string"
},
"workspaceRegion": {
"type": "string"
}
},
"variables": {
"locationLongNameToShortMap": {
"australiacentral": "CAU",
"australiaeast": "EAU",
"australiasoutheast": "SEAU",
"brazilsouth": "CQ",
"canadacentral": "CCA",
"canadaeast": "CCA",
"centralindia": "CIN",
"centralus": "CUS",
"eastasia": "EA",
"eastus2euap": "eus2p",
"eastus": "EUS",
"eastus2": "EUS2",
"francecentral": "PAR",
"germanywestcentral": "DEWC",
"japaneast": "EJP",
"japanwest": "EJP",
"jioindiawest": "CIN",
"koreacentral": "SE",
"koreasouth": "SE",
"northcentralus": "NCUS",
"northeurope": "NEU",
"norwayeast": "NOE",
"southafricanorth": "JNB",
"southcentralus": "SCUS",
"southeastasia": "SEA",
"southindia": "CIN",
"swedencentral": "SEC",
"switzerlandnorth": "CHN",
"switzerlandwest": "CHW",
"uaenorth": "DXB",
"uksouth": "SUK",
"ukwest": "WUK",
"westcentralus": "WCUS",
"westeurope": "WEU",
"westindia": "CIN",
"westus": "WUS",
"westus2": "WUS2"
},
"locationCode": "[variables('locationLongNameToShortMap')[parameters('workspaceRegion')]]",
"subscriptionId": "[subscription().subscriptionId]",
"defaultRGName": "[concat('DefaultResourceGroup-', variables('locationCode'))]",
"dcrName": "[concat('Microsoft-Security-', parameters('workspaceRegion'), '-dcr')]",
"dcrId": "[concat('/subscriptions/', variables('subscriptionId'), '/resourceGroups/', variables('defaultRGName'), '/providers/Microsoft.Insights/dataCollectionRules/', variables('dcrName'))]",
"dcraName": "[concat(parameters('vmName'),'/Microsoft.Insights/Security-RulesAssociation')]"
},
"resources": [
{
"type": "Microsoft.Compute/virtualMachines/providers/dataCollectionRuleAssociations",
"name": "[variables('dcraName')]",
"apiVersion": "2021-04-01",
"properties": {
"description": "Association of data collection rule for Microsoft Defender for Cloud. Deleting this association will break the detection of security vulnerabilities for this virtual machine.",
"dataCollectionRuleId": "[variables('dcrId')]"
}
}
]
}
}
}
}
}
},
"versions": [
"2.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/9c0aa188-e5fe-4569-8f74-b6e155624d9a",
"name": "9c0aa188-e5fe-4569-8f74-b6e155624d9a"
}# Converted from ASC_AMA_UserWorkspacePipeline_DCRA_DINE.json by ConvertTo-Bylaw.
Policy '9c0aa188-e5fe-4569-8f74-b6e155624d9a' {
Properties @{
DisplayName = '[Deprecated]: Configure Association to link virtual machines to user-defined Microsoft Defender for Cloud Data Collection Rule'
Description = 'This policy is deprecated as part of Microsoft Defender for Cloud updated strategy. As part of this strategy, Azure Monitor agent is no longer required to receive Defender for Servers security features, but is required for Defender for SQL Server on machines. For more information visit: https://aka.ms/MdcAgentStrategy. Configure machines to automatically create an association with the user-defined data collection rule for Microsoft Defender for Cloud.'
Category = 'Security Center'
Version = '2.0.1-deprecated'
Deprecated = $true
PolicyVersion = '2.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter WorkspaceRegion @{
Type = 'String'
DisplayName = 'Workspace region'
Description = 'Region of the Workspace to which the virtual machines in scope will send their logs. Needed to create the Data Collection Rule in the same region'
Metadata = [ordered]@{ strongType = 'location' }
}
Resource 'Microsoft.Compute/virtualMachines' {
Require 'location is not one of 35 values' {
Field location | Must -Not -BeIn @('australiacentral', 'australiaeast', 'australiasoutheast', 'brazilsouth', 'canadacentral', 'canadaeast', 'centralindia', 'centralus', 'eastasia', 'eastus2euap', 'eastus', 'eastus2', 'francecentral', 'germanywestcentral', 'japaneast', 'japanwest', 'jioindiawest', 'koreacentral', 'koreasouth', 'northcentralus', 'northeurope', 'norwayeast', 'southafricanorth', 'southcentralus', 'southeastasia', 'southindia', 'switzerlandnorth', 'uaenorth', 'uksouth', 'ukwest', 'westcentralus', 'westeurope', 'westindia', 'westus', 'westus2') -IfPresent
}
}
DeployIfNotExists 'Microsoft.Insights/dataCollectionRuleAssociations' -Role 'Monitoring Contributor', 'Log Analytics Contributor' -Name 'Security-RulesAssociation' -Effect (Param Effect) {
Deployment -TemplateFile './templates/9c0aa188-e5fe-4569-8f74-b6e155624d9a.json' -Parameters ([ordered]@{
resourceGroup = (Arm '[resourceGroup().name]')
vmName = (Arm '[field(''name'')]')
workspaceRegion = (Param WorkspaceRegion)
})
}
}Its deployment templates are written beside it:
templates/9c0aa188-e5fe-4569-8f74-b6e155624d9a.json
Source: built-in-policies/policyDefinitions/Security Center/ASC_AMA_UserWorkspacePipeline_DCRA_DINE.json in Azure/azure-policy, under the MIT licence.
Bylaw