skip to Main Content

A customer has multiple resource groups in Azure with multiple virtual networks and many private DNS zones to enable private endpoints. Some of the private DNS zones are in different resource groups, but with the same domain name (e.g. privatelink.azurewebsites.net).
I have some virtual networks, where I want to know what private DNS zones are connected to them via Virtual network links.

I have a list of the virtual networks that are connected to a specific private DNS zone, but I don’t see the corresponding list at the virtual network. Is there a list inside the portal where I can see the Virtual network links?

2

Answers


  1. I tried to reproduce the same in my environment I got the result successfully like below.

    In your private dns zone you can able to filter which virtual network link connected private DNS zone like below:

    In search -> click group by virtual network link or virtual network link with auto registration enabled:

    enter image description here

    Is there a list inside the portal where I can see the Virtual network links?

    To view virtual network links on particular resource group:

    In your private dns zone-> under setting -> click virtual network links like below

    enter image description here

    You can also make use of Azure CLI to view virtual network links like below:

    enter image description here

    Login or Signup to reply.
  2. This is not exactly what you asked and isn’t from the portal but an alternative if you’re comfortable giving it a try with PowerShell. You can try extracting the Private DNS Zone and its associated records and Vnet-links using PowerShell and send to a csv file. In this way you can easily identify what Vnets connected to your private dns zone just filter the VnetLinkId column and you’re good to go.

    Here is a code snippet you can use:

    Note: You need to use Connect-AzAccount first before running this snippet

    
    $subscriptionId = your subscription ID"
    Set-AzContext -SubscriptionId $subscriptionId
    $subName = "your Subscription Name"
    
    $reportName1 = "PrivateDNSZone.csv"
    Select-AzSubscription $subscriptionId
    $report = @()
    $Zones = Get-AzPrivateDnsZone
    foreach ($zone in $Zones){ 
        $vnet_link = Get-AzPrivateDnsVirtualNetworkLink -ResourceGroupName $zone.ResourceGroupName -ZoneName $zone.Name
        $record_set = Get-AzPrivateDnsRecordSet -ResourceGroupName $zone.ResourceGroupName -ZoneName $zone.Name
        foreach ($record in $record_set){
            foreach ($link in $vnet_link){ 
                $info = "" | Select Subscription, ResourceGroupName, PrivateDNSZoneName, RecordSet, RecordType, Records, Ttl, IsAutoRegistered, VnetLinkName, VnetLinkId, RegistrationEnabled, VirtualNetworkLinkState, ProvisioningState
                $info.Subscription = $subName
                $info.ResourceGroupName = $zone.ResourceGroupName
                #$info.Location = $zone.Location
                $info.PrivateDNSZoneName = $zone.Name
    
                $info.RecordSet = $record.Name
                $info.RecordType = $record.RecordType
                if ($record.RecordType -eq 'A'){
                    $info.Records = $record.Records.Ipv4Address -join ","
                }
                elseif ($record.RecordType -eq 'CNAME'){
                    $info.Records = $record.Records.Cname -join ","
                }
                elseif ($record.RecordType -eq 'SOA') {
                    $info.Records = $record.Records.Host -join ","
                }
                else{
                    $info.Records = $record.Records
                }
                $info.Ttl = $record.Ttl
                $info.IsAutoRegistered = $record.IsAutoRegistered
    
                $info.VnetLinkName = $link.Name 
                $info.VnetLinkId = $link.VirtualNetworkId
                $info.RegistrationEnabled = $link.RegistrationEnabled
                $info.VirtualNetworkLinkState = $link.VirtualNetworkLinkState
                $info.ProvisioningState = $link.ProvisioningState
    
                $report += $info 
            }
        }
    }
    $report | ft Subscription, ResourceGroupName, PrivateDNSZoneName, RecordSet, RecordType, Records, Ttl, IsAutoRegistered, VnetLinkName, VnetLinkId, RegistrationEnabled, VirtualNetworkLinkState, ProvisioningState
    $report | Export-CSV "$reportName1" -Encoding Default
    
    

    Here is a snapshot of the csv file with the details extracted

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search