last sync: 2021-Oct-22 15:42:38 UTC

Azure Policy definition

Virtual networks should be protected by Azure DDoS Protection Standard

Name Virtual networks should be protected by Azure DDoS Protection Standard
Azure Portal
Id 94de2ad3-e0c1-4caf-ad78-5d47bbc83d3d
Version 1.0.0
details on versioning
Category Network
Microsoft docs
Description Protect your virtual networks against volumetric and protocol attacks with Azure DDoS Protection Standard. For more information, visit https://aka.ms/ddosprotectiondocs.
Mode Indexed
Type BuiltIn
Preview FALSE
Deprecated FALSE
Effect Default: Modify
Allowed: (Modify, Audit, Disabled)
Used RBAC Role
Role Name Role Id
Network Contributor 4d97b98b-1d4f-4787-a291-c67834d212e7
History
Date/Time (UTC ymd) (i) Change type Change detail
2021-03-31 14:35:06 add 94de2ad3-e0c1-4caf-ad78-5d47bbc83d3d
Used in Initiatives none
JSON
{
  "displayName": "Virtual networks should be protected by Azure DDoS Protection Standard",
  "policyType": "BuiltIn",
  "mode": "Indexed",
  "description": "Protect your virtual networks against volumetric and protocol attacks with Azure DDoS Protection Standard. For more information, visit https://aka.ms/ddosprotectiondocs.",
  "metadata": {
    "version": "1.0.0",
    "category": "Network"
  },
  "parameters": {
    "effect": {
      "type": "String",
      "metadata": {
        "displayName": "Effect",
        "description": "Enable or disable the execution of the policy"
      },
      "allowedValues": [
        "Modify",
        "Audit",
        "Disabled"
      ],
      "defaultValue": "Modify"
    },
    "ddosPlan": {
      "type": "String",
      "metadata": {
        "displayName": "DDoS Protection Plan",
        "description": "DDoS Protection Plan resource to be associated to the virtual networks",
        "strongType": "Microsoft.Network/ddosProtectionPlans"
      }
    }
  },
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.Network/virtualNetworks"
        },
        {
          "anyOf": [
            {
              "field": "Microsoft.Network/virtualNetworks/enableDdosProtection",
              "notEquals": true
            },
            {
              "field": "Microsoft.Network/virtualNetworks/ddosProtectionPlan",
              "equals": ""
            }
          ]
        }
      ]
    },
    "then": {
      "effect": "[parameters('effect')]",
      "details": {
        "conflictEffect": "audit",
        "roleDefinitionIds": [
          "/providers/microsoft.authorization/roleDefinitions/4d97b98b-1d4f-4787-a291-c67834d212e7"
        ],
        "operations": [
          {
            "operation": "addOrReplace",
            "field": "Microsoft.Network/virtualNetworks/enableDdosProtection",
            "value": true
          },
          {
            "operation": "addOrReplace",
            "field": "Microsoft.Network/virtualNetworks/ddosProtectionPlan.id",
            "value": "[parameters('ddosPlan')]"
          }
        ]
      }
    }
  }
}