Gallery › Network › Azure built-in policies
Web Application Firewall (WAF) should be enabled for Application Gateway
Converted Policy Audit Deny Disabled Mode Indexed Version 2.0.0
Deploy Azure Web Application Firewall (WAF) in front of public facing web applications for additional inspection of incoming traffic. Web Application Firewall (WAF) provides centralized protection of your web applications from common exploits and vulnerabilities such as SQL injections, Cross-Site Scripting, local and remote file executions. You can also restrict access to your web applications by countries, IP address ranges, and other http(s) parameters via custom rules.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "Web Application Firewall (WAF) should be enabled for Application Gateway",
"description": "Deploy Azure Web Application Firewall (WAF) in front of public facing web applications for additional inspection of incoming traffic. Web Application Firewall (WAF) provides centralized protection of your web applications from common exploits and vulnerabilities such as SQL injections, Cross-Site Scripting, local and remote file executions. You can also restrict access to your web applications by countries, IP address ranges, and other http(s) parameters via custom rules.",
"policyType": "BuiltIn",
"mode": "Indexed",
"metadata": {
"version": "2.0.0",
"category": "Network"
},
"version": "2.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/applicationGateways"
},
{
"field": "Microsoft.Network/applicationGateways/webApplicationFirewallConfiguration",
"exists": "false"
},
{
"field": "Microsoft.Network/applicationGateways/firewallPolicy",
"exists": "false"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"2.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/564feb30-bf6a-4854-b4bb-0d2d2d1e6c66",
"name": "564feb30-bf6a-4854-b4bb-0d2d2d1e6c66"
}# Converted from WAF_AppGatewayEnabled_Audit.json by ConvertTo-Bylaw.
Policy '564feb30-bf6a-4854-b4bb-0d2d2d1e6c66' {
Properties @{
DisplayName = 'Web Application Firewall (WAF) should be enabled for Application Gateway'
Description = 'Deploy Azure Web Application Firewall (WAF) in front of public facing web applications for additional inspection of incoming traffic. Web Application Firewall (WAF) provides centralized protection of your web applications from common exploits and vulnerabilities such as SQL injections, Cross-Site Scripting, local and remote file executions. You can also restrict access to your web applications by countries, IP address ranges, and other http(s) parameters via custom rules.'
Version = '2.0.0'
Category = 'Network'
PolicyVersion = '2.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Network/applicationGateways' {
When {
Field webApplicationFirewallConfiguration | Must -Not -Exist
}
Require 'firewallPolicy exists' {
Field firewallPolicy | Must -Exist
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Network/WAF_AppGatewayEnabled_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw