How can I bulk delete DNS records in M365?

June 8, 2025 2 answers
Asked by TechWanderer92
I've ended up with a huge number of DNS records in my M365 account, and I have no idea how they got there. I'm guessing they were auto-generated when I switched from my old provider to Microsoft. I really don't need these records anymore, but the only way I see to delete them is one by one, which would take forever. Is there a PowerShell command or some other method to remove all these A records at once?

Answers

CloudGuru88
It's always good to double-check why you're deleting records. I've seen cases where customers lost important DNS entries when they moved ownership without understanding what each record was for. Just make sure you really donโ€™t need any of those records before you start deleting.

TechWanderer92: Thanks for the heads up! But this is my own account, and Iโ€™ve used a dynamic IP service, so I know none of these records are critical for me.

Reply to this answer
ScriptingNinja21
I haven't done this myself, but you could try using the Az PowerShell module. Here's a link that might help you get started: https://learn.microsoft.com/en-us/powershell/module/az.dns/remove-azdnsrecordset?view=azps-14.0.0. Just make sure you have the module installed and are logged into your Azure account. You might be able to bulk delete by looping through the records if they're in Azure DNS.

TechWanderer92: I appreciate that! I think that PowerShell method is specific to Azure DNS, and my domains arenโ€™t under that, but itโ€™s a good start. Thanks!

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions