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.
- Setup file output environment folders – TenantID\SubscriptionName\PublicDNSZones and\or PrivateDNSZones.
- Enumerate all DNS Zones within subscription (Get-AzDnsZone / Get-AzPrivateDnsZone)
- 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)
- 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.