@jansi rani krishnan Thank you for reaching out to Microsoft Q&A. I understand that you are having issues with Azure App GW throwing the above error when making the JSON request as explained above.
In order to work around this, you either have to fix the validation error in your application or disable body inspection in App GW. Here is how to disable body inspection:
To disable request body check via AZ PS:
New-AzApplicationGatewayFirewallPolicySetting (Az.Network)
New-AzApplicationGatewayFirewallPolicySetting
[-Mode <String>]
[-State <String>]
[-DisableRequestBodyCheck]
[-MaxRequestBodySizeInKb <Int32>]
[-MaxFileUploadInMb <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Example:
$condition = New-AzApplicationGatewayFirewallPolicySetting -State $enabledState -Mode $enabledMode -DisableRequestBodyCheck -MaxFileUploadInMb $fileUploadLimitInMb -MaxRequestBodySizeInKb $maxRequestBodySizeInKb
The new policySettings is stored to $condition.
Then you set the FW WAF policy to use the policy setting above; reference: Set-AzApplicationGatewayFirewallPolicy (Az.Network)
IN other words; in your script, you set the below:
$policySetting = New-AzApplicationGatewayFirewallPolicySetting -Mode Prevention -State Enabled
You need to add new switch: -DisableRequestBodyCheck with no value:
$policySetting = New-AzApplicationGatewayFirewallPolicySetting -Mode Prevention -State Enabled -DisableRequestBodyCheck
Reference: New-AzApplicationGatewayFirewallPolicySetting (Az.Network)
If using AZ CLI, you can use the following command:
az network application-gateway waf-config
az network application-gateway waf-config set --enabled {false, true}
[--disabled-rule-groups]
[--disabled-rules]
[--exclusion]
[--file-upload-limit]
[--firewall-mode {Detection, Prevention}]
[--gateway-name]
[--ids]
[--max-request-body-size]
[--no-wait]
[--request-body-check {false, true}]
[--resource-group]
[--rule-set-type]
[--rule-set-version]
[--subscription]
Please let us know if you have any further questions and we will be glad to assist you further. Thank you!
Remember:
Hope this helps. Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
Want a reminder to come back and check responses? Here is how to subscribe to a notification.