Skip to content

Instantly share code, notes, and snippets.

@esarabadani
Last active June 28, 2023 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esarabadani/1fb6352657ba66ad4fb0899ba405c0bb to your computer and use it in GitHub Desktop.
Save esarabadani/1fb6352657ba66ad4fb0899ba405c0bb to your computer and use it in GitHub Desktop.
resources
| where type =~ "Microsoft.Network/loadBalancers"
| mv-expand backendAddressPool=properties.backendAddressPools
| mv-expand ipconfig=backendAddressPool.properties.backendIPConfigurations
| extend ipconfig_id=tostring(ipconfig.id)
| project LB_name=name, ipconfig_id
| join (
resources
| where type =~ "Microsoft.Network/networkInterfaces"
| mv-expand ipconfig=properties.ipConfigurations
| extend ipconfig_id = tostring(ipconfig.id)
| extend nic_id = id
| extend nic_name = name
| project ipconfig_id, nic_id, nic_name) on ipconfig_id
| project LB_name, nic_name, nic_id, ipconfig_id
| join (
resources | where type =~ "Microsoft.Compute/virtualMachines"
| mv-expand nic=properties.networkProfile.networkInterfaces
| extend nic_id = tostring(nic.id)
| extend vm_name = name
| mv-expand az_assignment = zones
| project nic_id, vm_name, az_assignment, app_tag=tostring(tags.App)) on nic_id
| project Load_Balancer=LB_name, Virtual_Machine=vm_name, Network_Interface=nic_name, Availability_Zone=az_assignment, Application=app_tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment