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)
pazdedav
Jun 22, 2021MVP
Hi deb0093 ,
For network peering you could try something like:
resources
| where type =~ 'microsoft.network/virtualNetworks'
| mv-expand peering=properties.virtualNetworkPeerings
| where peering.properties.remoteVirtualNetwork.id contains "/subscriptions/xxx-xxx-xxxx-xxxx"
For blobs with public access:
Resources
| where type =~ 'microsoft.storage/storageaccounts'
| where properties.allowBlobPublicAccess == true