Azure Resource Graph 不支持诸如“let”之类的 KQL 语言元素,这使得创建自定义数据变得困难,解决此问题的一种方法是扩展现有表的列
如果您想进行精确比较,那么连接就足够了
resources
| take 1
| project ComparisonIPs = pack_array("1.1.1.1","2.2.2.2","3.3.3.3","4.4.4.4")
| mv-expand ComparisonIPs to typeof(string)
| join kind = innerunique (
// Your
resources
| where type == "microsoft.network/publicipaddresses"
| project ipAddress = tostring(parse_json(properties).ipAddress), id
) on $left.ComparisonIPs == $right.ipAddress
或者,要在谓词上进行比较,请创建一个通用列来连接两个数据集,执行内部连接,然后对结果集进行比较
resources
| take 1
| project ComparisonIPs = pack_array("1.1.1.1","2.2.2.2","3.3.3.3","4.4.4.4")
| mv-expand ComparisonIPs to typeof(string)
| extend Parsed = parse_ipv4(ComparisonIPs)
| extend JoinColumn = "1"
| join kind = inner (
resources
| where type == "microsoft.network/publicipaddresses"
| project ipAddress = tostring(parse_json(properties).ipAddress)
| extend Parsed = parse_ipv4(ipAddress)
| extend JoinColumn = "1"
) on JoinColumn
| where Parsed > Parsed1
还有其他选项,具体取决于您尝试实现的目标,例如在 Azure Monitor 工作簿中将数据作为参数传递,并在 Log Analytics 中重用 ARG 结果,可能引用 externaldata() 或 Azure Sentinel 中的监视列表。