我目前的任务是审查 Azure 租户内的所有 WAF 规则 - 具体来说,我需要审查自定义规则。
在这次旅程中,我发现了 Azure Resource Graph Explorer,这是我以前从未使用过的。我很了解我的 KQL,但不太清楚如何查询 WAF 自定义规则。
到目前为止,我可以使用以下命令获取所有 WAF 策略的列表:
resources
| where type == "microsoft.network/applicationgatewaywebapplicationfirewallpolicies
但是我需要查询“应用程序网关 WAF 策略”下方的此表,乍一看,它表明它将包含 WAF 自定义规则的列表。
但是,当我尝试像下面这样查询该表时,我得到 0 个结果:
resources
| where type == "microsoft.network/applicationgatewaywebapplicationfirewallpolicies/customrules"
我认为我只是误解了如何使用 Azure Resource Graph Explorer,但任何建议将不胜感激。
使用 Azure Resource Graph Explorer 查询所有 Azure WAF 规则
这里是资源图查询,用于检查不同
Web Application Firewall policies
中的多个自定义规则。
resources
| where type == "microsoft.network/applicationgatewaywebapplicationfirewallpolicies"
| extend customRules = properties.customRules
| mv-expand customRules
| project
PolicyName = name,
RuleName = customRules.name,
Priority = customRules.priority,
Action = customRules.action,
MatchConditions = customRules.matchConditions
输出:
运行查询后,它会显示所有自定义规则名称和操作以及 WAF 名称。