{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "Compose_Request_Body": { "inputs": { "location": "@body('Parse_JSON')?['location']", "properties": { "customRules": "@union(body('Parse_JSON')?['properties']?['customRules'],outputs('New_customRules'))", "managedRules": "@body('Parse_JSON')?['properties']?['managedRules']", "policySettings": "@body('Parse_JSON')?['properties']?['policySettings']" } }, "runAfter": { "Parse_JSON": [ "Succeeded" ] }, "type": "Compose" }, "Invoke_an_HTTP_request": { "inputs": { "body": { "method": "GET", "url": "https://management.azure.com/subscriptions/{yoursubscriptionID}/resourceGroups/{resourcegroup}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyname}?api-version=2021-03-01" }, "host": { "connection": { "name": "@parameters('$connections')['webcontents']['connectionId']" } }, "method": "post", "path": "/codeless/InvokeHttp" }, "runAfter": {}, "type": "ApiConnection" }, "Invoke_an_HTTP_request_2": { "inputs": { "body": { "body": "@{base64(outputs('Compose_Request_Body'))}", "method": "PUT", "url": "https://management.azure.com/subscriptions/{yoursubscriptionID}/resourceGroups/{resourcegroup}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyname}?api-version=2021-03-01" }, "host": { "connection": { "name": "@parameters('$connections')['webcontents']['connectionId']" } }, "method": "post", "path": "/codeless/InvokeHttp" }, "runAfter": { "Compose_Request_Body": [ "Succeeded" ] }, "type": "ApiConnection" }, "New_customRules": { "inputs": [ { "action": "Block", "matchConditions": [ { "matchValues": [ "evilbot" ], "matchVariables": [ { "selector": "User-Agent", "variableName": "RequestHeaders" } ], "negationConditon": false, "operator": "Contains", "transforms": [ "Lowercase" ] } ], "name": "blockEvilBot", "priority": 2, "rateLimitThreshold": 0, "ruleType": "MatchRule", "skippedManagedRuleSets": [] } ], "runAfter": { "Invoke_an_HTTP_request": [ "Succeeded" ] }, "type": "Compose" }, "Parse_JSON": { "inputs": { "content": "@body('Invoke_an_HTTP_request')", "schema": { "properties": { "etag": { "type": "string" }, "id": { "type": "string" }, "location": { "type": "string" }, "name": { "type": "string" }, "properties": { "properties": { "customRules": { "type": "array" }, "managedRules": { "properties": { "exclusions": { "items": { "properties": { "matchVariable": { "type": "string" }, "selector": { "type": "string" }, "selectorMatchOperator": { "type": "string" } }, "required": [ "matchVariable", "selectorMatchOperator", "selector" ], "type": "object" }, "type": "array" }, "managedRuleSets": { "items": { "properties": { "ruleGroupOverrides": { "type": "array" }, "ruleSetType": { "type": "string" }, "ruleSetVersion": { "type": "string" } }, "required": [ "ruleSetType", "ruleSetVersion", "ruleGroupOverrides" ], "type": "object" }, "type": "array" } }, "type": "object" }, "policySettings": { "properties": { "fileUploadLimitInMb": { "type": "integer" }, "maxRequestBodySizeInKb": { "type": "integer" }, "mode": { "type": "string" }, "requestBodyCheck": { "type": "boolean" }, "state": { "type": "string" } }, "type": "object" }, "provisioningState": { "type": "string" } }, "type": "object" }, "tags": { "properties": { "CreatedBy": { "type": "string" }, "CreatedDate": { "type": "string" }, "OwningTeam": { "type": "string" }, "Reason": { "type": "string" } }, "type": "object" }, "type": { "type": "string" } }, "type": "object" } }, "runAfter": { "New_customRules": [ "Succeeded" ] }, "type": "ParseJson" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": { "$connections": { "defaultValue": {}, "type": "Object" } }, "triggers": { "manual": { "inputs": { "schema": {} }, "kind": "Http", "type": "Request" } } }, "parameters": { "$connections": { "value": { "webcontents": { "connectionId": "/subscriptions/{yoursubscriptionID}/resourceGroups/{resourcegroupoflogicapp}/providers/Microsoft.Web/connections/webcontents", "connectionName": "webcontents", "id": "/subscriptions/{yoursubscriptionID}/providers/Microsoft.Web/locations/northcentralus/managedApis/webcontents" } } } } }