Dave's little Spot on the net

  • About
  • Blog

Export Azure DNS Zones

Posted by David Roitman on September 25, 2021
Posted in: Azure, Script.

I added another function to the “Az-GatherInfoFuncs” script and called it “Get-AzDNSDetails” which is designed to export the DNS records from Azure both Azure Public and Private DNS zones. Using the specified Subscription name as a parameter it finds all the DNS Zones within the subscription and for each zone then just fetches the records using Get-AzDnsRecordSet and writes the details out to text file in default format as well as in table format.

  1. Setup file output environment folders – TenantID\SubscriptionName\PublicDNSZones and\or PrivateDNSZones.
  2. Enumerate all DNS Zones within subscription (Get-AzDnsZone / Get-AzPrivateDnsZone)
  3. If Public DNS Zones exist, cycle through each zone.
    • Get DNS Records (Get-AzDnsRecordSet)
    • Write to file in default format (DDMMYYYY-hhmm-zone.txt)
    • Write to file in Table format (DDMMYYYY-hhmm-zone-table.txt)
  4. If Private DNS Zones exist, cycle through each zone.
    • Get DNS Records (Get-AzPrivateDnsRecordSet)
    • Write to file in default format (DDMMYYYY-hhmm-zone.txt)
    • Write to file in Table format (DDMMYYYY-hhmm-zone-table.txt)

This particular function does not call the file comparison function at https://github.com/roity57/Azure-Gather-and-Compare-Info/blob/master/Modules/CompareFunc.ps1 but this can be used to run comparisons between exports to identify where changes may have occurred.

Most scripts have been tested in PS 5 & 7 across Az Module 4.x and 6.x on Windows VMs.

Posts navigation

← Synchronise Azure Route Table from Az BGP or text file source
Basic AZ Subnet Listing →
  • Recent Posts

    • Secure Cross-region load-balanced Server deployment
    • Extract Azure Logs
    • Basic AZ Subnet Listing
    • Export Azure DNS Zones
    • Synchronise Azure Route Table from Az BGP or text file source
  • Categories

  • Archives

    • May 2023
    • July 2022
    • September 2021
    • October 2020
    • August 2020
    • July 2020
    • June 2020
Proudly powered by WordPress Theme: Parament by Automattic.