Gallery › Security Center › Azure Landing Zones Library
Deploy Microsoft Defender for Cloud Security Contacts
Converted Policy DeployIfNotExists Disabled Mode All Version 3.0.0
Deploy Microsoft Defender for Cloud Security Contacts
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeploy-ASC-SecurityContacts.alz_policy_definition.json · 207 lines
{
"name": "Deploy-ASC-SecurityContacts",
"properties": {
"description": "Deploy Microsoft Defender for Cloud Security Contacts",
"displayName": "Deploy Microsoft Defender for Cloud Security Contacts",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "Security Center",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "3.0.0"
},
"mode": "All",
"parameters": {
"attackPathSeverity": {
"allowedValues": [
"Critical",
"High",
"Medium",
"Low"
],
"defaultValue": "Critical",
"metadata": {
"description": "Defines the minimal attack path risk level which will be sent as email notifications",
"displayName": "Attack path severity"
},
"type": "String"
},
"effect": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
},
"emailSecurityContact": {
"metadata": {
"description": "Provide email addresses (semi-colon separated) for Defender for Cloud contact details",
"displayName": "Security contacts email address"
},
"type": "String"
},
"minimalSeverity": {
"allowedValues": [
"High",
"Medium",
"Low"
],
"defaultValue": "High",
"metadata": {
"description": "Defines the minimal alert severity which will be sent as email notifications",
"displayName": "Minimal severity"
},
"type": "String"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Resources/subscriptions",
"field": "type"
}
]
},
"then": {
"details": {
"deployment": {
"location": "northeurope",
"properties": {
"mode": "incremental",
"parameters": {
"attackPathSeverity": {
"value": "[parameters('attackPathSeverity')]"
},
"emailSecurityContact": {
"value": "[parameters('emailSecurityContact')]"
},
"minimalSeverity": {
"value": "[parameters('minimalSeverity')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"attackPathSeverity": {
"metadata": {
"description": "Attack path severity level reported"
},
"type": "string"
},
"emailSecurityContact": {
"metadata": {
"description": "Security contacts email address"
},
"type": "string"
},
"minimalSeverity": {
"metadata": {
"description": "Minimal severity level reported"
},
"type": "string"
}
},
"resources": [
{
"apiVersion": "2023-12-01-preview",
"name": "default",
"properties": {
"emails": "[parameters('emailSecurityContact')]",
"isEnabled": true,
"notificationsByRole": {
"roles": [
"Owner"
],
"state": "On"
},
"notificationsSources": [
{
"minimalSeverity": "[parameters('minimalSeverity')]",
"sourceType": "Alert"
},
{
"minimalRiskLevel": "[parameters('attackPathSeverity')]",
"sourceType": "AttackPath"
}
]
},
"type": "Microsoft.Security/securityContacts"
}
],
"variables": {}
}
}
},
"deploymentScope": "subscription",
"existenceCondition": {
"allOf": [
{
"contains": "[parameters('emailSecurityContact')]",
"field": "Microsoft.Security/securityContacts/email"
},
{
"equals": true,
"field": "Microsoft.Security/securityContacts/isEnabled"
},
{
"count": {
"field": "Microsoft.Security/securityContacts/notificationsSources[*]",
"where": {
"allOf": [
{
"equals": "Alert",
"field": "Microsoft.Security/securityContacts/notificationsSources[*].sourceType"
},
{
"equals": "[parameters('minimalSeverity')]",
"field": "Microsoft.Security/securityContacts/notificationsSources[*].Alert.minimalSeverity"
}
]
}
},
"greaterOrEquals": 1
},
{
"count": {
"field": "Microsoft.Security/securityContacts/notificationsSources[*]",
"where": {
"allOf": [
{
"equals": "AttackPath",
"field": "Microsoft.Security/securityContacts/notificationsSources[*].sourceType"
},
{
"equals": "[parameters('attackPathSeverity')]",
"field": "Microsoft.Security/securityContacts/notificationsSources[*].AttackPath.minimalRiskLevel"
}
]
}
},
"greaterOrEquals": 1
}
]
},
"existenceScope": "subscription",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/fb1c8493-542b-48eb-b624-b4c8fea62acd"
],
"type": "Microsoft.Security/securityContacts"
},
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeploy-ASC-SecurityContacts.bylaw.ps1 · 63 lines
# Converted from Deploy-ASC-SecurityContacts.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deploy-ASC-SecurityContacts' {
Properties @{
DisplayName = 'Deploy Microsoft Defender for Cloud Security Contacts'
Description = 'Deploy Microsoft Defender for Cloud Security Contacts'
Category = 'Security Center'
Version = '3.0.0'
Mode = 'All'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter AttackPathSeverity @{
AllowedValues = @('Critical', 'High', 'Medium', 'Low')
Default = 'Critical'
DisplayName = 'Attack path severity'
Description = 'Defines the minimal attack path risk level which will be sent as email notifications'
}
Parameter Effect @{
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter EmailSecurityContact @{
Type = 'String'
DisplayName = 'Security contacts email address'
Description = 'Provide email addresses (semi-colon separated) for Defender for Cloud contact details'
}
Parameter MinimalSeverity @{
AllowedValues = @('High', 'Medium', 'Low')
Default = 'High'
DisplayName = 'Minimal severity'
Description = 'Defines the minimal alert severity which will be sent as email notifications'
}
Resource 'Microsoft.Resources/subscriptions'
DeployIfNotExists 'Microsoft.Security/securityContacts' -Role 'Security Admin' -ExistenceScope Subscription -Effect (Param Effect) {
Require 'email, isEnabled, notificationsSources and 3 more are as required' {
Field email | Must -ContainText (Param EmailSecurityContact)
Field isEnabled | Must -Be $true
Count 'notificationsSources[*]' -Where {
Field sourceType | Must -Be 'Alert'
Field Alert.minimalSeverity | Must -Be (Param MinimalSeverity)
} | Must -BeGreaterOrEqual 1
Count 'notificationsSources[*]' -Where {
Field sourceType | Must -Be 'AttackPath'
Field AttackPath.minimalRiskLevel | Must -Be (Param AttackPathSeverity)
} | Must -BeGreaterOrEqual 1
}
Deployment @{
TemplateFile = './templates/Deploy-ASC-SecurityContacts.json'
Scope = 'Subscription'
Location = 'northeurope'
Parameters = [ordered]@{
attackPathSeverity = (Param AttackPathSeverity)
emailSecurityContact = (Param EmailSecurityContact)
minimalSeverity = (Param MinimalSeverity)
}
}
}
}Its deployment templates are written beside it:
templates/Deploy-ASC-SecurityContacts.json
Source: policy_definitions/Deploy-ASC-SecurityContacts.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw