Forum Discussion
Sibba_Sailor
Mar 24, 2023Copper Contributor
Azure Web Application Firewall (WAF) REGEX for Match Variable Selector
Hi Experts, We are trying to migrate our WAF solution to Azure WAF, and some validation rules use REGEX to match the Variable Selector. We are trying to implement the same on Azure WAF and are not s...
shankerhari
Apr 04, 2023MCT
The answer is Yes, Azure WAF does support Regular Expressions (regex) for defining validation rules, so you should be able to implement your current rule in Azure WAF as well. Below are the steps to create a validation rule using regex in Azure WAF:
Open the Azure Portal and navigate to your Application Gateway instance.
In the left-hand menu, click on "Web application firewall".
Click on "Managed rules".
Click on "Add rule".
In the "Validation rule" section, select "Custom rule".
In the "Match conditions" section, select "Post args".
In the "Post args selector" field, enter your regex pattern: "arg\d{1,4}".
In the "Operator" and "Action" fields, enter the desired values for your rule.
Save the rule.
Hope that helps!
Open the Azure Portal and navigate to your Application Gateway instance.
In the left-hand menu, click on "Web application firewall".
Click on "Managed rules".
Click on "Add rule".
In the "Validation rule" section, select "Custom rule".
In the "Match conditions" section, select "Post args".
In the "Post args selector" field, enter your regex pattern: "arg\d{1,4}".
In the "Operator" and "Action" fields, enter the desired values for your rule.
Save the rule.
Hope that helps!
- Sibba_SailorApr 07, 2023Copper Contributor
Hi Shanker,
The field allows us to put the RegEx for Post Args Selector but I am not sure if it is supported as I could not test it. The Azure documentation does not mention the support of RegEx for the Selector (https://learn.microsoft.com/en-us/azure/web-application-firewall/ag/custom-waf-rules-overview#selector-optional).Were you able to implement and test it successfully?
Also, take a look at the Question that I had posted for the same that says it is not currently supported.
https://learn.microsoft.com/en-us/answers/questions/1192824/azure-web-application-firewall-(waf)-regex-for-mat?page=1&orderby=Helpful&comment=answer-1193007#newest-answer-comment