azurednsazure-dnsazure-private-dns-zone

Azure automating CNAME checks in DNS zones?


Is it possible to access these CNAME and other entries through some sort of scripting? I tried using a logic app but could only access the resource group, name, subscription id, etc. but not the more detailed information such as the record sets that are displayed when 'overview' is selected in a given DNS zone.

Perhaps AzCLI or powershell? Any push in the right direction would be greatly appreciated.


Solution

  • You can get the DNS records with the Azure CLI or PowerShell.

    For example, to list the DNS records in your private DNS zone, run the PowerShell command Get-AzPrivateDnsRecordSet:

    $RecordSets = Get-AzPrivateDnsRecordSet -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
    
    Id                : /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myresourcegroup/providers/Micros
                        oft.Network/privateDnsZones/myzone.com/AAAA/www1
    Name              : www1
    ZoneName          : myzone.com
    ResourceGroupName : MyResourceGroup
    Ttl               : 3600
    Etag              : xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    RecordType        : A
    Records           : {1.2.3.4}
    Metadata          :
    IsAutoRegistered  :
    
    Id                : /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myresourcegroup/providers/Micros
                        oft.Network/privateDnsZones/myzone.com/AAAA/www1
    Name              : www1
    ZoneName          : myzone.com
    ResourceGroupName : MyResourceGroup
    Ttl               : 3600
    Etag              : xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    RecordType        : AAAA
    Records           : {2001:DB80:4009:1803::1005}
    Metadata          :
    IsAutoRegistered  :