Jun 21 2021
- last edited on
Apr 08 2022
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.
Jun 22 2021 08:03 AM
Hi @deb0093 ,
For network peering you could try something like:
Jun 24 2021 04:17 AM - edited Jun 24 2021 04:30 AM
Jun 24 2021 04:37 AM
Actually, the xxx-xxx-xxx-xxx string is a placeholder for a subscription ID (not a tenant ID). You said you wanted to query all VNET peerings coming from a particular subscription. You simply provide a subscription ID directly in the KQL query (if it's static).
The easiest way to test it is by using Azure Resource Graph Explorer directly in the Portal, where you select 1-n subscriptions from the drop-down as a scope for your query (i.e. subscriptions, where you want to look for peerings) and run the query (after you replace xxx-xxx... string with an actual subID you are interested in).
When you see it's working, you can switch to PowerShell or CLI to get the data programmatically.
I hope this answers your question.
Jun 24 2021 05:04 AM
Jun 24 2021 05:21 AM
Just to be clear on the scenario:
If you want the query to return two entries - VNETA and VNETB, you need to:
The query works in my environment. Perhaps if you send me a screenshot with the Graph Explorer, the query you tried and the result, I could look into it.
Jun 24 2021 06:46 AM - edited Jun 24 2021 09:03 AM
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.
Jun 29 2021 04:07 AMSolution
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: