【问题标题】:KQL / Azure Resource Graph Explorer: combine values from multiple recordsKQL / Azure Resource Graph Explorer:组合来自多条记录的值
【发布时间】:2021-10-01 14:49:08
【问题描述】:

我正在尝试获取为 azure 资源图资源管理器中的一组负载均衡器配置的所有公共 ip 和 fqdns。我通过以下查询获得了我需要的所有数据:

Resources
| where type =~ 'Microsoft.Network/loadBalancers'
| where subscriptionId =~ '11111111-2222-3333-4444-555555555555'
| where resourceGroup =~ 'resource-group-name'
| mv-expand ipConfig=properties.frontendIPConfigurations
| project name, publicIpId = tostring(ipConfig.properties.publicIPAddress.id)
| join kind=leftouter (
    Resources
    | where type =~ 'microsoft.network/publicipaddresses'
    | project publicIpId = id, publicIpAddress = tostring(properties.ipAddress), fqdn = tostring(properties.dnsSettings.fqdn)
)
on publicIpId
| summarize by name, publicIpAddress, fqdn

但是结果的形式是:

name              publicIpAddress       fqdn
outbound-lb       x.y.z.1               a domain
frontend-lb       x.y.z.2               another domain
frontend-lb       x.y.z.3               third domain
services-lb       x.y.z.4               fourth domain

而我需要的是:

name              publicIpAddress       fqdn
outbound-lb       x.y.z.1               a domain
frontend-lb       x.y.z.2, x.y.z.3      another domain, third domain
services-lb       x.y.z.4               fourth domain

我一直在查看summarize make_list() 函数,但没有成功获得我需要的结果!

【问题讨论】:

    标签: azure-data-explorer kql azure-resource-graph


    【解决方案1】:

    你可以尝试替换这个:

    | summarize by name, publicIpAddress, fqdn
    

    用这个:

    | summarize publicIpAddress = strcat_array(make_set(publicIpAddress), ", "), 
                fqdn = strcat_array(make_set(fqdn), ", ")
             by name
    

    【讨论】:

    • 非常感谢您的快速回答!我是 KQL 和 Azure 资源浏览器的新手,在这方面花了很长时间,但没有取得任何进展!现在可以了!
    猜你喜欢
    • 2023-01-30
    • 1970-01-01
    • 2014-07-16
    • 2021-04-14
    • 2021-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-06
    相关资源
    最近更新 更多