@@ -4208,3 +4208,54 @@ function Test-ApplicationGatewayFirewallPolicyWithCustomRules
4208
4208
Clean - ResourceGroup $rgname
4209
4209
}
4210
4210
}
4211
+
4212
+ function Test-ApplicationGatewayFirewallPolicyWithUppercaseTransform
4213
+ {
4214
+ # Setup
4215
+ $location = Get-ProviderLocation " Microsoft.Network/applicationGateways" " West US 2"
4216
+
4217
+ $rgname = Get-ResourceGroupName
4218
+ $wafPolicy = Get-ResourceName
4219
+
4220
+ try
4221
+ {
4222
+ $resourceGroup = New-AzResourceGroup - Name $rgname - Location $location - Tags @ { testtag = " APPGw tag" }
4223
+
4224
+ # WAF Policy and Custom Rule
4225
+ $variable = New-AzApplicationGatewayFirewallMatchVariable - VariableName RequestHeaders - Selector Content- Length
4226
+ $condition = New-AzApplicationGatewayFirewallCondition - MatchVariable $variable - Operator GreaterThan - MatchValue 1000 - Transform Uppercase - NegationCondition $False
4227
+ $rule = New-AzApplicationGatewayFirewallCustomRule - Name example - Priority 2 - RuleType MatchRule - MatchCondition $condition - Action Block
4228
+ $policySettings = New-AzApplicationGatewayFirewallPolicySetting - Mode Prevention - State Enabled - MaxFileUploadInMb 70 - MaxRequestBodySizeInKb 70
4229
+ $managedRuleSet = New-AzApplicationGatewayFirewallPolicyManagedRuleSet - RuleSetType " OWASP" - RuleSetVersion " 3.2"
4230
+ $managedRule = New-AzApplicationGatewayFirewallPolicyManagedRule - ManagedRuleSet $managedRuleSet
4231
+ New-AzApplicationGatewayFirewallPolicy - Name $wafPolicy - ResourceGroupName $rgname - Location $location - ManagedRule $managedRule - PolicySetting $policySettings
4232
+
4233
+ $policy = Get-AzApplicationGatewayFirewallPolicy - Name $wafPolicy - ResourceGroupName $rgname
4234
+ $policy.CustomRules = $rule
4235
+ Set-AzApplicationGatewayFirewallPolicy - InputObject $policy
4236
+
4237
+ $policy = Get-AzApplicationGatewayFirewallPolicy - Name $wafPolicy - ResourceGroupName $rgname
4238
+
4239
+ # Second check firewll policy
4240
+ Assert-AreEqual $policy.CustomRules [0 ].Name $rule.Name
4241
+ Assert-AreEqual $policy.CustomRules [0 ].RuleType $rule.RuleType
4242
+ Assert-AreEqual $policy.CustomRules [0 ].Action $rule.Action
4243
+ Assert-AreEqual $policy.CustomRules [0 ].Priority $rule.Priority
4244
+ Assert-AreEqual $policy.CustomRules [0 ].MatchConditions[0 ].OperatorProperty $rule.MatchConditions [0 ].OperatorProperty
4245
+ Assert-AreEqual $policy.CustomRules [0 ].MatchConditions[0 ].Transforms[0 ] $rule.MatchConditions [0 ].Transforms[0 ]
4246
+ Assert-AreEqual $policy.CustomRules [0 ].MatchConditions[0 ].NegationConditon $rule.MatchConditions [0 ].NegationConditon
4247
+ Assert-AreEqual $policy.CustomRules [0 ].MatchConditions[0 ].MatchValues[0 ] $rule.MatchConditions [0 ].MatchValues[0 ]
4248
+ Assert-AreEqual $policy.CustomRules [0 ].MatchConditions[0 ].MatchVariables[0 ].VariableName $rule.MatchConditions [0 ].MatchVariables[0 ].VariableName
4249
+ Assert-AreEqual $policy.CustomRules [0 ].MatchConditions[0 ].MatchVariables[0 ].Selector $rule.MatchConditions [0 ].MatchVariables[0 ].Selector
4250
+ Assert-AreEqual $policy.PolicySettings.FileUploadLimitInMb $policySettings.FileUploadLimitInMb
4251
+ Assert-AreEqual $policy.PolicySettings.MaxRequestBodySizeInKb $policySettings.MaxRequestBodySizeInKb
4252
+ Assert-AreEqual $policy.PolicySettings.RequestBodyCheck $policySettings.RequestBodyCheck
4253
+ Assert-AreEqual $policy.PolicySettings.Mode $policySettings.Mode
4254
+ Assert-AreEqual $policy.PolicySettings.State $policySettings.State
4255
+ }
4256
+ finally
4257
+ {
4258
+ # Cleanup
4259
+ Clean - ResourceGroup $rgname
4260
+ }
4261
+ }
0 commit comments