Bylaw

Gallery › Network › Azure built-in policies

[Deprecated]: Web Application Firewall should be enabled for Azure Front Door Service or Application Gateway

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0-deprecated Deprecated

Requires Web Application Firewall on any Azure Front Door Service or Application Gateway. A Web Application Firewall provides greater security for your other Azure resources.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONEnabledWAF_Deny.json · 67 lines
{
  "properties": {
    "displayName": "[Deprecated]: Web Application Firewall should be enabled for Azure Front Door Service or Application Gateway",
    "description": "Requires Web Application Firewall on any Azure Front Door Service or Application Gateway. A Web Application Firewall provides greater security for your other Azure resources.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "Network",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Deny"
      }
    },
    "policyRule": {
      "if": {
        "anyOf": [
          {
            "allOf": [
              {
                "field": "type",
                "equals": "Microsoft.Network/frontdoors"
              },
              {
                "field": "Microsoft.Network/frontdoors/frontendEndpoints[*].webApplicationFirewallPolicyLink.id",
                "exists": "false"
              }
            ]
          },
          {
            "allOf": [
              {
                "field": "type",
                "equals": "Microsoft.Network/applicationGateways"
              },
              {
                "field": "Microsoft.Network/applicationGateways/webApplicationFirewallConfiguration",
                "exists": "false"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/be7ed5c8-2660-4136-8216-e6f3412ba909",
  "name": "be7ed5c8-2660-4136-8216-e6f3412ba909"
}
Bylawbe7ed5c8-2660-4136-8216-e6f3412ba909.bylaw.ps1 · 41 lines
# Converted from EnabledWAF_Deny.json by ConvertTo-Bylaw.
Policy 'be7ed5c8-2660-4136-8216-e6f3412ba909' {

    Properties @{
        DisplayName   = '[Deprecated]: Web Application Firewall should be enabled for Azure Front Door Service or Application Gateway'
        Description   = 'Requires Web Application Firewall on any Azure Front Door Service or Application Gateway. A Web Application Firewall provides greater security for your other Azure resources.'
        Version       = '1.0.0-deprecated'
        Category      = 'Network'
        Deprecated    = $true
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Deny'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource * {

        Require 'type, frontendEndpoints and webApplicationFirewallPolicyLink.id are as required' {
            AnyOf {
                Field type | Must -Not -Be 'Microsoft.Network/frontdoors' -IfPresent
                Count 'Microsoft.Network/frontdoors/frontendEndpoints[*]' -Where {
                    Field webApplicationFirewallPolicyLink.id | Must -Exist
                } | Must -Not -Be 0
            }
        }

        Require 'type and webApplicationFirewallConfiguration are as required' {
            AnyOf {
                Field type | Must -Not -Be 'Microsoft.Network/applicationGateways' -IfPresent
                Field 'Microsoft.Network/applicationGateways/webApplicationFirewallConfiguration' | Must -Exist
            }
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Network/EnabledWAF_Deny.json in Azure/azure-policy, under the MIT licence.