我需要使用 Azure Resource Graph 在 Azure 中获取公共 ips 列表以及订阅名称、资源类型(例如 vm、应用程序网关、elb)。我还想显示公共 IP 地址。
这是我的草稿,但我不知道如何列出其他资源:
Resources
| where type =~ 'microsoft.compute/virtualmachines'
|project name, OS=tostring(properties.storageProfile.osDisk.osType), location,
ipid = tolower(tostring(properties.networkProfile.networkInterfaces[0].id))
| join kind=leftouter (
Resources
| where type =~ 'microsoft.network/networkinterfaces'
| project ipid = tolower(id), elasticPoolName = name,
publicIPid = properties.ipConfigurations[0].properties.publicIPAddress.id)
| join kind=leftouter (
Resources
| where type =~ 'microsoft.network/applicationGateways'
| project name, publicIP
on ipid
| project-away ipid
| project name, OS, location, pubipid=tolower(tostring(publicIPid))
| join kind=leftouter (
Resources
| where type =~ 'microsoft.network/publicipaddresses'
| project pubipid = tolower(id), publicIP = properties.ipAddress)
on pubipid
| project-away pubipid
| project name, publicIP, OS, location