Bylaw

Gallery › Network › Azure built-in policies

[Deprecated]: Web Application Firewall (WAF) should enable all firewall rules for Application Gateway

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

This policy is deprecated because sometimes it is impractical to enable all WAF rules. Instead of continuing to use this policy, we recommend you instead assign this replacement policy with policy ID 564feb30-bf6a-4854-b4bb-0d2d2d1e6c66. Learn more details about the latest M365 APP Compliance requirements about network security controls at aka.ms/acat-cert2-seg-ops-nsc. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.

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

Azure Policy JSONACAT_WAF_AppGatewayAllRulesEnabled_Audit.json · 54 lines
{
  "properties": {
    "displayName": "[Deprecated]: Web Application Firewall (WAF) should enable all firewall rules for Application Gateway",
    "policyType": "BuiltIn",
    "description": "This policy is deprecated because sometimes it is impractical to enable all WAF rules. Instead of continuing to use this policy, we recommend you instead assign this replacement policy with policy ID 564feb30-bf6a-4854-b4bb-0d2d2d1e6c66.  Learn more details about the latest M365 APP Compliance requirements about network security controls at aka.ms/acat-cert2-seg-ops-nsc. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.",
    "mode": "Indexed",
    "metadata": {
      "version": "1.1.0-deprecated",
      "category": "Network",
      "deprecated": true
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Disabled"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Network/applicationGateways"
          },
          {
            "count": {
              "field": "Microsoft.Network/applicationGateways/webApplicationFirewallConfiguration.disabledRuleGroups[*]"
            },
            "notEquals": 0
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.1.0",
      "1.0.1"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/632d3993-e2c0-44ea-a7db-2eca131f356d",
  "name": "632d3993-e2c0-44ea-a7db-2eca131f356d"
}
Bylaw632d3993-e2c0-44ea-a7db-2eca131f356d.bylaw.ps1 · 29 lines
# Converted from ACAT_WAF_AppGatewayAllRulesEnabled_Audit.json by ConvertTo-Bylaw.
Policy '632d3993-e2c0-44ea-a7db-2eca131f356d' {

    Properties @{
        DisplayName   = '[Deprecated]: Web Application Firewall (WAF) should enable all firewall rules for Application Gateway'
        Description   = 'This policy is deprecated because sometimes it is impractical to enable all WAF rules. Instead of continuing to use this policy, we recommend you instead assign this replacement policy with policy ID 564feb30-bf6a-4854-b4bb-0d2d2d1e6c66.  Learn more details about the latest M365 APP Compliance requirements about network security controls at aka.ms/acat-cert2-seg-ops-nsc. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.'
        Version       = '1.1.0-deprecated'
        Category      = 'Network'
        Deprecated    = $true
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Network/applicationGateways' {

        Require 'webApplicationFirewallConfiguration.disabledRuleGroups is as required' {
            Count 'webApplicationFirewallConfiguration.disabledRuleGroups[*]' | Must -Be 0
        }
    }

    Effect (Param Effect)
}

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