I'm inquiring about how to delete Azure DNS.

Techsupport uPrism 20 Reputation points
2023-12-05T01:38:13.8966667+00:00

Due to the termination of the service contract, we would like to delete 20000 DNSs created for auto-scaling.
Is there a way to delete a domain containing a specific word in bulk?

EX) Delete all DNS with 'gne-'

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
777 questions
{count} votes

Accepted answer
  1. TP 125.8K Reputation points Volunteer Moderator
    2023-12-06T06:14:04.6466667+00:00

    Hi,

    Before making changes to your DNS Zone, please Export your zone using the button at the top with down arrow icon. This will download a .txt file of your zone that you can import back in if necessary. After downloading, please open the file and make sure it has the contents of your zone.

    Please see sample PowerShell code below to delete all A records that start with "gne-". You may run it in Azure CloudShell:

    $recordSets = Get-AzDnsRecordSet -ResourceGroupName "uprism" -ZoneName "uprism.io" -RecordType A
    $recordSets|ForEach-Object {if ($_.Name -like "gne-*") {Remove-AzDnsRecordSet -RecordSet $_ }}
    
    

    Please click Accept Answer and upvote if the above was helpful.

    Thanks.

    -TP

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.