Fix Azure Virtual Network Waf Errors
When working with Azure Virtual Network, you may encounter a configuration error that prevents your deployment from working. This guide explains the most common mistake with waf and shows the exact fix.
A Common Mistake
Not deploying Azure Web Application Firewall (WAF) in front of public web applications, leaving them vulnerable to OWASP Top 10 attacks.
The incorrect command:
az network application-gateway create --name my-appgw --resource-group my-rg --sku Standard_v2 --capacity 2 --vnet-name my-vnet --subnet appgw-subnet --public-ip-address appgw-pip --servers 10.100.1.4 10.100.1.5
Error output:
Application Gateway created without WAF.
No protection against:
- SQL injection: /products?id=1' OR '1'='1
- XSS: <script>alert('xss')</script>
- Path traversal: /../../etc/passwd
- OWASP Top 10 attacks
The Correct Approach
The right way to configure waf in Azure Virtual Network:
az network application-gateway waf-config set --gateway-name my-appgw --resource-group my-rg --enabled true --firewall-mode Prevention --rule-set-type OWASP --rule-set-version 3.2
Successful result:
WAF enabled on Application Gateway.
Attack attempts are blocked:
curl /products?id=1' OR '1'='1
403 Forbidden: The Web Application Firewall blocked your request.
SQL injection attempt detected and blocked. WAF rule 942100 triggered.
How to Prevent This
Deploy WAF for all public web applications. WAF supports OWASP 3.x rulesets, custom rules, bot protection, and Rate Limiting. WAF can be deployed on Application Gateway or Azure Front Door. WAF logs help analyze attack patterns. Enable WAF in Prevention mode for production.
FAQ
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Secure your cloud with DodaTech.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro