mystack
mystack

Reputation: 5492

Modify the Azure application gateway rule using rest api

I was trying to enable/disable the ApplicationGateway WAF rules using Postman's rest API.

enter image description here

I tried to disable the rules 200003 and 200004 using rest API.

I was using the below URL for the REST API

https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/AppGatewayRG/providers/Microsoft.Network/applicationGateways/tvsapplicationgateway?api-version=2020-11-01

In the request body, I was using the below JSON code

  {
    "location": "eastus",
    "properties": {
    "webApplicationFirewallConfiguration": {
        "enabled": true,
        "firewallMode": "Prevention",
        "ruleSetType": "OWASP",
        "ruleSetVersion": "3.2",
        "disabledRuleGroups": ["General"],
         "rules": [200003,200004],
         "requestBodyCheck": true,
         "maxRequestBodySizeInKb": 128,
         "fileUploadLimitInMb": 100,
         "exclusions": []
    }
  }
}

But when I execute it using Postman I get the error

enter image description here

I could find the following definition from the Azure doc site, but I am not sure how to use it in the Request header https://learn.microsoft.com/en-us/rest/api/application-gateway/application-gateways/create-or-update?tabs=HTTP#applicationgatewayfirewalldisabledrulegroup

Upvotes: 0

Views: 271

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136196

Can you try with the following request body:

{
    "location": "eastus",
    "properties": {
    "webApplicationFirewallConfiguration": {
        "enabled": true,
        "firewallMode": "Prevention",
        "ruleSetType": "OWASP",
        "ruleSetVersion": "3.2",
        "disabledRuleGroups": [{
            "ruleGroupName": "General",
            "rules": [200003,200004]
        }],
         "requestBodyCheck": true,
         "maxRequestBodySizeInKb": 128,
         "fileUploadLimitInMb": 100,
         "exclusions": []
    }
  }
}

Reference: https://learn.microsoft.com/en-us/rest/api/application-gateway/application-gateways/create-or-update?tabs=HTTP#applicationgatewaywebapplicationfirewallconfiguration

Upvotes: 0

Related Questions