{ "swagger": "2.0", "info": { "version": "2025-03-01", "title": "WebApplicationFirewallManagement", "description": "APIs to manage web application firewall rules." }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies": { "get": { "tags": [ "WebApplicationFirewallPolicies" ], "description": "Lists all of the protection policies within a resource group.", "operationId": "WebApplicationFirewallPolicies_List", "x-ms-examples": { "Lists all WAF policies in a resource group": { "$ref": "./examples/WafListPolicies.json" } }, "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "$ref": "./network.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "OK. The request has succeeded.", "schema": { "$ref": "#/definitions/WebApplicationFirewallPolicyListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies": { "get": { "tags": [ "WebApplicationFirewallPolicies" ], "description": "Gets all the WAF policies in a subscription.", "operationId": "WebApplicationFirewallPolicies_ListAll", "x-ms-examples": { "Lists all WAF policies in a subscription": { "$ref": "./examples/WafListAllPolicies.json" } }, "parameters": [ { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "$ref": "./network.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "OK. The request has succeeded.", "schema": { "$ref": "#/definitions/WebApplicationFirewallPolicyListResult" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}": { "get": { "tags": [ "WebApplicationFirewallPolicies" ], "description": "Retrieve protection policy with specified name within a resource group.", "operationId": "WebApplicationFirewallPolicies_Get", "x-ms-examples": { "Gets a WAF policy within a resource group": { "$ref": "./examples/WafPolicyGet.json" } }, "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "policyName", "in": "path", "required": true, "type": "string", "maxLength": 128, "description": "The name of the policy." }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "$ref": "./network.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "OK. The request has succeeded.", "schema": { "$ref": "#/definitions/WebApplicationFirewallPolicy" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } } }, "put": { "tags": [ "WebApplicationFirewallPolicies" ], "description": "Creates or update policy with specified rule set name within a resource group.", "operationId": "WebApplicationFirewallPolicies_CreateOrUpdate", "x-ms-examples": { "Creates or updates a WAF policy within a resource group": { "$ref": "./examples/WafPolicyCreateOrUpdate.json" } }, "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "policyName", "in": "path", "required": true, "type": "string", "maxLength": 128, "description": "The name of the policy." }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "description": "Policy to be created.", "in": "body", "name": "parameters", "required": true, "schema": { "$ref": "#/definitions/WebApplicationFirewallPolicy" } }, { "$ref": "./network.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "OK. The request has succeeded.", "schema": { "$ref": "#/definitions/WebApplicationFirewallPolicy" } }, "201": { "description": "Created. The request has been fulfilled and a new protection policy has been created.", "schema": { "$ref": "#/definitions/WebApplicationFirewallPolicy" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } } }, "delete": { "tags": [ "WebApplicationFirewallPolicies" ], "description": "Deletes Policy.", "operationId": "WebApplicationFirewallPolicies_Delete", "x-ms-examples": { "Deletes a WAF policy within a resource group": { "$ref": "./examples/WafPolicyDelete.json" } }, "parameters": [ { "name": "resourceGroupName", "in": "path", "required": true, "type": "string", "description": "The name of the resource group." }, { "name": "policyName", "in": "path", "required": true, "type": "string", "maxLength": 128, "description": "The name of the policy." }, { "$ref": "./network.json#/parameters/SubscriptionIdParameter" }, { "$ref": "./network.json#/parameters/ApiVersionParameter" } ], "responses": { "202": { "description": "Accepted. The request has been accepted for processing and the operation will complete asynchronously." }, "204": { "description": "No Content. The request has been accepted but the policy was not found." }, "200": { "description": "Delete successful." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./network.json#/definitions/CloudError" } } }, "x-ms-long-running-operation": true, "x-ms-long-running-operation-options": { "final-state-via": "location" } } } }, "definitions": { "WebApplicationFirewallPolicy": { "description": "Defines web application firewall policy.", "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/WebApplicationFirewallPolicyPropertiesFormat", "description": "Properties of the web application firewall policy." }, "etag": { "readOnly": true, "type": "string", "description": "A unique read-only string that changes whenever the resource is updated." } }, "allOf": [ { "$ref": "./network.json#/definitions/Resource" } ] }, "WebApplicationFirewallPolicyPropertiesFormat": { "description": "Defines web application firewall policy properties.", "required": [ "managedRules" ], "properties": { "policySettings": { "description": "The PolicySettings for policy.", "$ref": "#/definitions/PolicySettings" }, "customRules": { "description": "The custom rules inside the policy.", "type": "array", "items": { "$ref": "#/definitions/WebApplicationFirewallCustomRule" } }, "applicationGateways": { "readOnly": true, "type": "array", "items": { "$ref": "./applicationGateway.json#/definitions/ApplicationGateway" }, "description": "A collection of references to application gateways." }, "provisioningState": { "readOnly": true, "$ref": "./network.json#/definitions/ProvisioningState", "description": "The provisioning state of the web application firewall policy resource." }, "resourceState": { "title": "Resource status of the policy.", "readOnly": true, "type": "string", "description": "Resource status of the policy.", "enum": [ "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting" ], "x-ms-enum": { "name": "WebApplicationFirewallPolicyResourceState", "modelAsString": true } }, "managedRules": { "description": "Describes the managedRules structure.", "$ref": "#/definitions/ManagedRulesDefinition" }, "httpListeners": { "readOnly": true, "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "A collection of references to application gateway http listeners." }, "pathBasedRules": { "readOnly": true, "type": "array", "items": { "$ref": "./network.json#/definitions/SubResource" }, "description": "A collection of references to application gateway path rules." }, "applicationGatewayForContainers": { "readOnly": true, "type": "array", "items": { "$ref": "#/definitions/ApplicationGatewayForContainersReferenceDefinition" }, "description": "A collection of references to application gateway for containers." } } }, "WebApplicationFirewallPolicyListResult": { "description": "Result of the request to list WebApplicationFirewallPolicies. It contains a list of WebApplicationFirewallPolicy objects and a URL link to get the next set of results.", "properties": { "value": { "type": "array", "readOnly": true, "items": { "$ref": "#/definitions/WebApplicationFirewallPolicy" }, "description": "List of WebApplicationFirewallPolicies within a resource group." }, "nextLink": { "readOnly": true, "type": "string", "description": "URL to get the next set of WebApplicationFirewallPolicy objects if there are any." } } }, "ManagedRulesDefinition": { "description": "Allow to exclude some variable satisfy the condition for the WAF check.", "required": [ "managedRuleSets" ], "properties": { "exceptions": { "type": "array", "items": { "$ref": "#/definitions/ExceptionEntry" }, "description": "The exceptions that are applied on the policy." }, "exclusions": { "type": "array", "items": { "$ref": "#/definitions/OwaspCrsExclusionEntry" }, "description": "The Exclusions that are applied on the policy." }, "managedRuleSets": { "type": "array", "items": { "$ref": "#/definitions/ManagedRuleSet" }, "description": "The managed rule sets that are associated with the policy." } } }, "PolicySettings": { "description": "Defines contents of a web application firewall global configuration.", "properties": { "state": { "description": "The state of the policy.", "type": "string", "enum": [ "Disabled", "Enabled" ], "x-ms-enum": { "name": "WebApplicationFirewallEnabledState", "modelAsString": true } }, "mode": { "description": "The mode of the policy.", "type": "string", "enum": [ "Prevention", "Detection" ], "x-ms-enum": { "name": "WebApplicationFirewallMode", "modelAsString": true } }, "requestBodyCheck": { "type": "boolean", "description": "Whether to allow WAF to check request Body." }, "requestBodyInspectLimitInKB": { "type": "integer", "format": "int32", "description": "Max inspection limit in KB for request body inspection for WAF." }, "requestBodyEnforcement": { "type": "boolean", "default": true, "description": "Whether allow WAF to enforce request body limits." }, "maxRequestBodySizeInKb": { "type": "integer", "format": "int32", "minimum": 8, "exclusiveMinimum": false, "description": "Maximum request body size in Kb for WAF." }, "fileUploadEnforcement": { "type": "boolean", "default": true, "description": "Whether allow WAF to enforce file upload limits." }, "fileUploadLimitInMb": { "type": "integer", "format": "int32", "minimum": 0, "exclusiveMinimum": false, "description": "Maximum file upload size in Mb for WAF." }, "customBlockResponseStatusCode": { "description": "If the action type is block, customer can override the response status code.", "type": "integer", "format": "int32", "minimum": 0 }, "customBlockResponseBody": { "description": "If the action type is block, customer can override the response body. The body must be specified in base64 encoding.", "type": "string", "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", "maxLength": 32768 }, "logScrubbing": { "description": "To scrub sensitive log fields", "type": "object", "properties": { "state": { "type": "string", "description": "State of the log scrubbing config. Default value is Enabled.", "enum": [ "Disabled", "Enabled" ], "x-ms-enum": { "name": "WebApplicationFirewallScrubbingState", "modelAsString": true } }, "scrubbingRules": { "type": "array", "items": { "$ref": "#/definitions/WebApplicationFirewallScrubbingRules" }, "x-ms-identifiers": [], "description": "The rules that are applied to the logs for scrubbing." } } }, "jsChallengeCookieExpirationInMins": { "description": "Web Application Firewall JavaScript Challenge Cookie Expiration time in minutes.", "type": "integer", "format": "int32", "minimum": 5, "maximum": 1440 } } }, "WebApplicationFirewallCustomRule": { "description": "Defines contents of a web application rule.", "required": [ "priority", "ruleType", "matchConditions", "action" ], "properties": { "name": { "type": "string", "description": "The name of the resource that is unique within a policy. This name can be used to access the resource.", "maxLength": 128 }, "etag": { "type": "string", "readOnly": true, "description": "A unique read-only string that changes whenever the resource is updated." }, "priority": { "description": "Priority of the rule. Rules with a lower value will be evaluated before rules with a higher value.", "type": "integer" }, "state": { "description": "Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified.", "type": "string", "enum": [ "Disabled", "Enabled" ], "x-ms-enum": { "name": "WebApplicationFirewallState", "modelAsString": true } }, "rateLimitDuration": { "type": "string", "description": "Duration over which Rate Limit policy will be applied. Applies only when ruleType is RateLimitRule.", "enum": [ "OneMin", "FiveMins" ], "x-ms-enum": { "name": "ApplicationGatewayFirewallRateLimitDuration", "modelAsString": true } }, "rateLimitThreshold": { "description": "Rate Limit threshold to apply in case ruleType is RateLimitRule. Must be greater than or equal to 1", "type": "integer", "format": "int32" }, "ruleType": { "description": "The rule type.", "type": "string", "enum": [ "MatchRule", "RateLimitRule", "Invalid" ], "x-ms-enum": { "name": "WebApplicationFirewallRuleType", "modelAsString": true } }, "matchConditions": { "description": "List of match conditions.", "type": "array", "items": { "$ref": "#/definitions/MatchCondition" } }, "groupByUserSession": { "description": "List of user session identifier group by clauses.", "type": "array", "x-ms-identifiers": [], "items": { "$ref": "#/definitions/GroupByUserSession" } }, "action": { "description": "Type of Actions.", "type": "string", "enum": [ "Allow", "Block", "Log", "JSChallenge" ], "x-ms-enum": { "name": "WebApplicationFirewallAction", "modelAsString": true } } } }, "Transform": { "description": "Transforms applied before matching.", "type": "string", "enum": [ "Uppercase", "Lowercase", "Trim", "UrlDecode", "UrlEncode", "RemoveNulls", "HtmlEntityDecode" ], "x-ms-enum": { "name": "WebApplicationFirewallTransform", "modelAsString": true } }, "MatchVariable": { "description": "Define match variables.", "required": [ "variableName" ], "properties": { "variableName": { "description": "Match Variable.", "type": "string", "enum": [ "RemoteAddr", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeaders", "RequestBody", "RequestCookies" ], "x-ms-enum": { "name": "WebApplicationFirewallMatchVariable", "modelAsString": true } }, "selector": { "description": "The selector of match variable.", "type": "string" } } }, "MatchCondition": { "description": "Define match conditions.", "required": [ "matchVariables", "operator", "matchValues" ], "properties": { "matchVariables": { "description": "List of match variables.", "type": "array", "items": { "$ref": "#/definitions/MatchVariable" } }, "operator": { "description": "The operator to be matched.", "type": "string", "enum": [ "IPMatch", "Equal", "Contains", "LessThan", "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", "EndsWith", "Regex", "GeoMatch", "Any" ], "x-ms-enum": { "name": "WebApplicationFirewallOperator", "modelAsString": true } }, "negationConditon": { "description": "Whether this is negate condition or not.", "type": "boolean" }, "matchValues": { "description": "Match value.", "type": "array", "items": { "type": "string" } }, "transforms": { "description": "List of transforms.", "type": "array", "items": { "$ref": "#/definitions/Transform" } } } }, "GroupByVariable": { "type": "object", "description": "Define user session group by clause variables.", "required": [ "variableName" ], "properties": { "variableName": { "description": "User Session clause variable.", "type": "string", "enum": [ "ClientAddr", "GeoLocation", "None", "ClientAddrXFFHeader", "GeoLocationXFFHeader" ], "x-ms-enum": { "name": "ApplicationGatewayFirewallUserSessionVariable", "modelAsString": true } } } }, "GroupByUserSession": { "type": "object", "description": "Define user session identifier group by clauses.", "required": [ "groupByVariables" ], "properties": { "groupByVariables": { "description": "List of group by clause variables.", "type": "array", "x-ms-identifiers": [], "items": { "$ref": "#/definitions/GroupByVariable" } } } }, "ManagedRuleSet": { "type": "object", "description": "Defines a managed rule set.", "required": [ "ruleSetType", "ruleSetVersion" ], "properties": { "ruleSetType": { "description": "Defines the rule set type to use.", "type": "string" }, "ruleSetVersion": { "description": "Defines the version of the rule set to use.", "type": "string" }, "ruleGroupOverrides": { "description": "Defines the rule group overrides to apply to the rule set.", "type": "array", "items": { "$ref": "#/definitions/ManagedRuleGroupOverride" } }, "computedDisabledRules": { "readOnly": true, "description": "Stores the final list of disabled rule groups", "type": "array", "items": { "$ref": "#/definitions/ManagedRuleSetRuleGroup" } } } }, "ManagedRuleGroupOverride": { "type": "object", "description": "Defines a managed rule group override setting.", "required": [ "ruleGroupName" ], "properties": { "ruleGroupName": { "description": "The managed rule group to override.", "type": "string" }, "rules": { "description": "List of rules that will be disabled. If none specified, all rules in the group will be disabled.", "type": "array", "items": { "$ref": "#/definitions/ManagedRuleOverride" } } } }, "ManagedRuleOverride": { "type": "object", "description": "Defines a managed rule group override setting.", "required": [ "ruleId" ], "properties": { "ruleId": { "description": "Identifier for the managed rule.", "type": "string" }, "state": { "description": "The state of the managed rule. Defaults to Disabled if not specified.", "type": "string", "enum": [ "Disabled", "Enabled" ], "x-ms-enum": { "name": "ManagedRuleEnabledState", "modelAsString": true } }, "action": { "description": "Describes the override action to be applied when rule matches.", "$ref": "#/definitions/ActionType" }, "sensitivity": { "description": "Describes the override sensitivity to be applied when rule matches.", "$ref": "#/definitions/SensitivityType" } } }, "ManagedRuleSetRuleGroup": { "description": "Defines a managed rule set rule group", "type": "object", "required": [ "ruleGroupName" ], "properties": { "ruleGroupName": { "description": "Name of the rule group", "type": "string" }, "rules": { "description": "List of rules within the rule group", "type": "array", "items": { "type": "string" } } } }, "ExclusionManagedRuleSet": { "type": "object", "description": "Defines a managed rule set for Exclusions.", "required": [ "ruleSetType", "ruleSetVersion" ], "properties": { "ruleSetType": { "description": "Defines the rule set type to use.", "type": "string" }, "ruleSetVersion": { "description": "Defines the version of the rule set to use.", "type": "string" }, "ruleGroups": { "description": "Defines the rule groups to apply to the rule set.", "type": "array", "items": { "$ref": "#/definitions/ExclusionManagedRuleGroup" } } } }, "ExclusionManagedRuleGroup": { "type": "object", "description": "Defines a managed rule group to use for exclusion.", "required": [ "ruleGroupName" ], "properties": { "ruleGroupName": { "description": "The managed rule group for exclusion.", "type": "string" }, "rules": { "description": "List of rules that will be excluded. If none specified, all rules in the group will be excluded.", "type": "array", "items": { "$ref": "#/definitions/ExclusionManagedRule" } } } }, "ExclusionManagedRule": { "type": "object", "description": "Defines a managed rule to use for exclusion.", "required": [ "ruleId" ], "properties": { "ruleId": { "description": "Identifier for the managed rule.", "type": "string" } } }, "OwaspCrsExclusionEntry": { "required": [ "matchVariable", "selectorMatchOperator", "selector" ], "description": "Allow to exclude some variable satisfy the condition for the WAF check.", "properties": { "matchVariable": { "type": "string", "enum": [ "RequestHeaderNames", "RequestCookieNames", "RequestArgNames", "RequestHeaderKeys", "RequestHeaderValues", "RequestCookieKeys", "RequestCookieValues", "RequestArgKeys", "RequestArgValues" ], "description": "The variable to be excluded.", "x-ms-enum": { "name": "OwaspCrsExclusionEntryMatchVariable", "modelAsString": true } }, "selectorMatchOperator": { "type": "string", "enum": [ "Equals", "Contains", "StartsWith", "EndsWith", "EqualsAny" ], "description": "When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to.", "x-ms-enum": { "name": "OwaspCrsExclusionEntrySelectorMatchOperator", "modelAsString": true } }, "selector": { "type": "string", "description": "When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to." }, "exclusionManagedRuleSets": { "type": "array", "items": { "$ref": "#/definitions/ExclusionManagedRuleSet" }, "description": "The managed rule sets that are associated with the exclusion." } } }, "ExceptionEntry": { "required": [ "matchVariable", "valueMatchOperator" ], "description": "Adds exception to allow a request when the condition is satisfied.", "type": "object", "properties": { "matchVariable": { "type": "string", "enum": [ "RequestURI", "RemoteAddr", "RequestHeader" ], "description": "The variable on which we evaluate the exception condition", "x-ms-enum": { "name": "ExceptionEntryMatchVariable", "modelAsString": true } }, "values": { "type": "array", "items": { "type": "string" }, "description": "Allowed values for the matchVariable" }, "valueMatchOperator": { "type": "string", "enum": [ "Equals", "Contains", "StartsWith", "EndsWith", "IPMatch" ], "x-ms-enum": { "name": "ExceptionEntryValueMatchOperator", "modelAsString": true }, "description": "Operates on the allowed values for the matchVariable" }, "selectorMatchOperator": { "type": "string", "enum": [ "Equals", "Contains", "StartsWith", "EndsWith" ], "description": "When the matchVariable points to a key-value pair (e.g, RequestHeader), this operates on the selector", "x-ms-enum": { "name": "ExceptionEntrySelectorMatchOperator", "modelAsString": true } }, "selector": { "type": "string", "description": "When the matchVariable points to a key-value pair (e.g, RequestHeader), this identifies the key." }, "exceptionManagedRuleSets": { "type": "array", "items": { "$ref": "#/definitions/ExclusionManagedRuleSet" }, "description": "The managed rule sets that are associated with the exception." } } }, "ActionType": { "description": "Defines the action to take on rule match.", "type": "string", "enum": [ "AnomalyScoring", "Allow", "Block", "Log", "JSChallenge" ], "x-ms-enum": { "name": "ActionType", "modelAsString": true } }, "SensitivityType": { "description": "Defines the sensitivity for the rule.", "type": "string", "enum": [ "Low", "Medium", "High" ], "x-ms-enum": { "name": "SensitivityType", "modelAsString": true } }, "WebApplicationFirewallScrubbingRules": { "description": "Allow certain variables to be scrubbed on WAF logs", "type": "object", "required": [ "matchVariable", "selectorMatchOperator" ], "properties": { "matchVariable": { "type": "string", "enum": [ "RequestHeaderNames", "RequestCookieNames", "RequestArgNames", "RequestPostArgNames", "RequestJSONArgNames", "RequestIPAddress" ], "description": "The variable to be scrubbed from the logs.", "x-ms-enum": { "name": "scrubbingRuleEntryMatchVariable", "modelAsString": true } }, "selectorMatchOperator": { "type": "string", "enum": [ "Equals", "EqualsAny" ], "description": "When matchVariable is a collection, operate on the selector to specify which elements in the collection this rule applies to.", "x-ms-enum": { "name": " scrubbingRuleEntryMatchOperator", "modelAsString": true } }, "selector": { "type": "string", "description": "When matchVariable is a collection, operator used to specify which elements in the collection this rule applies to." }, "state": { "type": "string", "enum": [ "Enabled", "Disabled" ], "description": "Defines the state of log scrubbing rule. Default value is Enabled.", "x-ms-enum": { "name": " scrubbingRuleEntryState", "modelAsString": true } } } }, "ApplicationGatewayForContainersReferenceDefinition": { "type": "object", "description": "Defines an application gateway for containers reference.", "required": [ "id" ], "properties": { "id": { "description": "Resource Id of the application gateway for containers.", "type": "string", "format": "arm-id", "x-ms-arm-id-details": { "allowedResources": [ { "type": "Microsoft.ServiceNetworking/trafficControllers" } ] } } } } } }