Jun 29 2023 06:18 AM
I am trying to retrieve a peering in a VNET using the below Resource Graph Query:
resources | where type =~ "microsoft.network/virtualnetworks" and name =~ "vnet1" | mv-expand peerings = properties.virtualNetworkPeerings | project peerings.id | where peerings_id =~ "/subscriptions/xxxxx/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peering123"
I get no results. However, if I try to retrieve the peering using Azure CLI, I get the response:
az network vnet peering show -g rg1 --subscription xxxxx --name peering123 --vnet-name vnet1
I tried to retrieve some other peerings in the VNET using this same Resource Graph Query and it gives me the result. What could be wrong with this peering so that this is not showing up in the result?
Note: people ask me why am I looking for a specific peering_id when I already know the peering id. Here is my answer below:
The original query
resources | where type =~ "microsoft.network/virtualnetworks" and name =~ "vnet1" | mv-expand peerings = properties.virtualNetworkPeerings | project peerings.id
wasn't returning all of the peerings, so I tried with a missing peering id specifically in the query to see if I get the result. I then compared it with the az CLI results to make sure that the peering really exists, but it is the Resource Graph query not showing it in the results.
Jul 04 2023 04:40 AM