I have try to define the azure WAF custom rule via Bicep in vs code (installed bicep plugin).
Such as
resource appGatewayFirewall 'Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2022-09-01' = {
name: firewallName
location: location
properties: {
customRules: [
{
name: 'grafanaazuremonitordatasource'
action: 'Allow'
priority: 15
ruleType: 'MatchRule'
matchConditions: [
{
matchVariables: [
{
variableName: 'RequestUri'
}
]
operator: 'Contains'
negationConditon: true
matchValues: [
'/api/ds/query?ds_type=grafana-azure-monitor-datasource'
]
}
]
}
]
policySettings: {
requestBodyCheck: true
maxRequestBodySizeInKb: 128
fileUploadLimitInMb: 100
state: 'Enabled'
mode: 'Prevention'
}
managedRules: {
managedRuleSets: [
{
ruleSetType: 'OWASP'
ruleSetVersion: '3.2'
ruleGroupOverrides: [
// If necessary and safe, you can disable necessary rules. e.g. like this
// {
// ruleGroupName: 'REQUEST-913-SCANNER-DETECTION'
// rules: [
// {
// ruleId: '913100'
// state: 'Disabled'
// action: 'AnomalyScoring'
// }
// ]
// }
]
}
]
exclusions: [
// If necessary and safe, you can disable checking specific arguments or parameters. e.g. like this:
// {
// "matchVariable": "RequestArgNames",
// "selectorMatchOperator": "Equals",
// "selector": "repairForm"
// }
]
}
}
}
In the matchConditions block,there is no parameter to define the Operation value “is” or “is not” according following image.
After I deploy the Bicep script successfully, the Operation value is “is not”,in fact I hope it is “is”. I dont know how to define this parameter name or format.
Thanks.
I have looked for the method in google,but failed.