How to query records of public azure dns zones via resource graph?

128 Views Asked by At

I try to utilize Azure Resource Graph to get all records from Public DNS zones, but I query dnsresources- oder resources- table its only containing private dns zones. Does anybody have an idea which table to query to get the records?

I only got this query to get all public dns zones but there are no records whether as properties nor as dedictated resource type.

resources
| where ['type'] == "microsoft.network/dnszones"
1

There are 1 best solutions below

1
Venkat V On

How to query records of public azure dns zones via resource graph?

To query the Public DNS zone records using resource graph, you can use the below query.

    resources
    | where type == "microsoft.network/dnszones"
    | where properties.zoneType == "Public"
    | extend NameServers = properties.nameServers
    | project ['id'],name,NameServers,resourceGroup,['type']

Response:

enter image description here

Alternatively, you can also use PowerShell to check the records in the Public DNS zone.

    $rg= Get-AzResourceGroup
    foreach($RG in $rg){
    $Rgname = $RG.ResourceGroupName
    $Zone = Get-AzDnsZone -ResourceGroupName $Rgname
    $Zone
    }

Output:

enter image description here