https://github.com/jksprattler/azure-networking
A collection of Azure Resource Graph queries related to capturing subscription, VNet, subnets, route tables, etc types of data
https://github.com/jksprattler/azure-networking
azure azure-cli vnet
Last synced: 2 months ago
JSON representation
A collection of Azure Resource Graph queries related to capturing subscription, VNet, subnets, route tables, etc types of data
- Host: GitHub
- URL: https://github.com/jksprattler/azure-networking
- Owner: jksprattler
- Created: 2021-06-22T01:10:24.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-12-23T17:48:59.000Z (over 3 years ago)
- Last Synced: 2026-01-01T02:37:33.166Z (6 months ago)
- Topics: azure, azure-cli, vnet
- Language: PowerShell
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Azure Resource Graph Collection
A collection of Azure Resource Graph queries related to capturing subscription, VNet, subnets, route tables, etc types of data
## Get all subnets sorted by subscription and location
```
Resources
| where type == "microsoft.network/virtualnetworks"
| mv-expand addressSpaces = properties.addressSpace.addressPrefixes
| mv-expand subnets=properties.subnets
| join kind=leftouter(
Resourcecontainers
| where type == 'microsoft.resources/subscriptions'
| project subscriptionId, subscriptionName = name) on subscriptionId
| project subscriptionName, subscriptionId, location, VNetName = name, subnet_name = subnets.name, subnet_prefixes = subnets.properties.addressPrefix
| order by subscriptionName asc, location asc
```
## Get all VNet's sorted by subscription and location
```
Resources
| where type == "microsoft.network/virtualnetworks"
| mv-expand addressSpaces = properties.addressSpace.addressPrefixes
| join kind=leftouter(
Resourcecontainers
| where type == 'microsoft.resources/subscriptions'
| project subscriptionId, subscriptionName = name) on subscriptionId
| project subscriptionName, subscriptionId, resourceGroup, name, location, addressSpaces
| order by subscriptionName asc, location asc
```
## Get all route tables associated with subnets containing "backend" in the name
```
Resources
| join kind=leftouter (
ResourceContainers
| where type=='microsoft.resources/subscriptions'
| project SubName=name, subscriptionId)
on subscriptionId
| where type=='microsoft.network/routetables' and split(properties['subnets'][0]['id'], "/", 10) contains '-backend'
| project SubName, subscriptionId, VNetName=split(properties['subnets'][0]['id'], "/", 8), SubnetName=split(properties['subnets'][0]['id'], "/", 10), RouteTable=name, resourceGroup, location
| mv-expand SubnetName,VNetName to typeof(string)
| order by SubName asc
```