Gallery › Security Center › Azure built-in policies
Azure DDoS Protection should be enabled
Converted Policy AuditIfNotExists Disabled Mode All Version 3.0.1
DDoS protection should be enabled for all virtual networks with a subnet that is part of an application gateway with a public IP.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONASC_EnableDDoSProtection_Audit.json · 53 lines
{
"properties": {
"displayName": "Azure DDoS Protection should be enabled",
"policyType": "BuiltIn",
"mode": "All",
"description": "DDoS protection should be enabled for all virtual networks with a subnet that is part of an application gateway with a public IP.",
"metadata": {
"version": "3.0.1",
"category": "Security Center"
},
"version": "3.0.1",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "microsoft.network/virtualNetworks"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Security/assessments",
"name": "e3de1cc0-f4dd-3b34-e496-8b5381ba2d70",
"existenceCondition": {
"field": "Microsoft.Security/assessments/status.code",
"in": [
"NotApplicable",
"Healthy"
]
}
}
}
},
"versions": [
"3.0.1",
"3.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/a7aca53f-2ed4-4466-a25e-0b45ade68efd",
"name": "a7aca53f-2ed4-4466-a25e-0b45ade68efd"
}Bylawa7aca53f-2ed4-4466-a25e-0b45ade68efd.bylaw.ps1 · 28 lines
# Converted from ASC_EnableDDoSProtection_Audit.json by ConvertTo-Bylaw.
Policy 'a7aca53f-2ed4-4466-a25e-0b45ade68efd' {
Properties @{
DisplayName = 'Azure DDoS Protection should be enabled'
Description = 'DDoS protection should be enabled for all virtual networks with a subnet that is part of an application gateway with a public IP.'
Version = '3.0.1'
Category = 'Security Center'
PolicyVersion = '3.0.1'
Mode = 'All'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'microsoft.network/virtualNetworks'
AuditIfNotExists 'Microsoft.Security/assessments' -Name 'e3de1cc0-f4dd-3b34-e496-8b5381ba2d70' -Effect (Param Effect) {
Require 'status.code is one of 2 values' {
Field status.code | Must -BeIn @('NotApplicable', 'Healthy')
}
}
}Source: built-in-policies/policyDefinitions/Security Center/ASC_EnableDDoSProtection_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw