Forum Discussion
deb0093
Jun 21, 2021Copper Contributor
KQL query for vnet peering count and storage public Access
Hi Team, I am looking to get the count of Vnet peering from specific subscriptions and storage container public access through KQL, Can someone please help me. Regards Dev
- Jun 29, 2021
Are you trying to get peering names or IDs of VNets the virtual networks you have access to are peered with? Or both?
Try this query, it should give you both properties and only list VNets that have some peering relationship:
resources| where type =~ 'microsoft.network/virtualNetworks'| mv-expand peering=properties.virtualNetworkPeerings| where notempty(peering)| project vnetId = id, vnetName = name, peeringName=tostring(peering.name), peeredVnetId=tostring(peering.properties.remoteVirtualNetwork.id)
deb0093
Jun 24, 2021Copper Contributor
May be I do not have access to Subscription B that's why no data, lets say I have Vnet peering in Subscription A where I have access and I just would like to see the vnet peering names from that subscription , how to get that in KQL. I am attaching the image file just for reference.
pazdedav
Jun 29, 2021MVP
Are you trying to get peering names or IDs of VNets the virtual networks you have access to are peered with? Or both?
Try this query, it should give you both properties and only list VNets that have some peering relationship:
resources
| where type =~ 'microsoft.network/virtualNetworks'
| mv-expand peering=properties.virtualNetworkPeerings
| where notempty(peering)
| project vnetId = id, vnetName = name, peeringName=tostring(peering.name), peeredVnetId=tostring(peering.properties.remoteVirtualNetwork.id)
- JunioroptumerNov 29, 2023Copper ContributorHello David,
Will this query work, If i want to get the peerings count a particular vnet inside a resource group.
Thank you!!