Skip to content

Commit 4702cf4

Browse files
Merge pull request #246703 from GitaraniSharma-MSFT/patch-88
(AzureCXP) MicrosoftDocs/azure-docs#112781
2 parents 6c16c94 + a6060fb commit 4702cf4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

articles/web-application-firewall/ag/configure-waf-custom-rules.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ $poolSetting01 = New-AzApplicationGatewayBackendHttpSettings -Name "setting1" -P
9595
-Protocol Http -CookieBasedAffinity Disabled
9696
9797
$rule01 = New-AzApplicationGatewayRequestRoutingRule -Name "rule1" -RuleType basic `
98-
-BackendHttpSettings $poolSetting01 -HttpListener $listener01 -BackendAddressPool $pool
98+
-BackendHttpSettings $poolSetting01 -HttpListener $listener01 -BackendAddressPool $pool -Priority 1000
9999
100100
$autoscaleConfig = New-AzApplicationGatewayAutoscaleConfiguration -MinCapacity 3
101101
@@ -105,8 +105,6 @@ $sku = New-AzApplicationGatewaySku -Name WAF_v2 -Tier WAF_v2
105105
### Create two custom rules and apply it to WAF policy
106106

107107
```azurepowershell
108-
# Create WAF config
109-
$wafConfig = New-AzApplicationGatewayWebApplicationFirewallConfiguration -Enabled $true -FirewallMode "Prevention" -RuleSetType "OWASP" -RuleSetVersion "3.0"
110108
# Create a User-Agent header custom rule
111109
$variable = New-AzApplicationGatewayFirewallMatchVariable -VariableName RequestHeaders -Selector User-Agent
112110
$condition = New-AzApplicationGatewayFirewallCondition -MatchVariable $variable -Operator Contains -MatchValue "evilbot" -Transform Lowercase -NegationCondition $False
@@ -118,7 +116,8 @@ $condition2 = New-AzApplicationGatewayFirewallCondition -MatchVariable $var2 -Op
118116
$rule2 = New-AzApplicationGatewayFirewallCustomRule -Name allowUS -Priority 14 -RuleType MatchRule -MatchCondition $condition2 -Action Allow -State Enabled
119117
120118
# Create a firewall policy
121-
$wafPolicy = New-AzApplicationGatewayFirewallPolicy -Name wafpolicyNew -ResourceGroup $rgname -Location $location -CustomRule $rule,$rule2
119+
$policySetting = New-AzApplicationGatewayFirewallPolicySetting -Mode Prevention -State Enabled
120+
$wafPolicy = New-AzApplicationGatewayFirewallPolicy -Name wafpolicyNew -ResourceGroup $rgname -Location $location -PolicySetting $PolicySetting -CustomRule $rule,$rule2
122121
```
123122

124123
### Create the Application Gateway
@@ -130,7 +129,6 @@ $appgw = New-AzApplicationGateway -Name $appgwName -ResourceGroupName $rgname `
130129
-GatewayIpConfigurations $gipconfig -FrontendIpConfigurations $fipconfig01 `
131130
-FrontendPorts $fp01 -HttpListeners $listener01 `
132131
-RequestRoutingRules $rule01 -Sku $sku -AutoscaleConfiguration $autoscaleConfig `
133-
-WebApplicationFirewallConfig $wafConfig `
134132
-FirewallPolicy $wafPolicy
135133
```
136134

0 commit comments

Comments
 (0)