Hey everyone! I've been deep into Azure backup projects over the past year, managing a massive setup of 2.9PB across four regions, which involves 72 Recovery Service Vaults (RSVs), 1800 virtual machines (VMs), 230 storage accounts, and 26 backup vaults. As part of a consolidation effort, I need to clean up a lot of outdated VMs and their restore points. We're looking at about 500 VMs that still have recovery points even though they've been deleted.
I'm in need of a solid script that can automate the process of deleting VM backups with restore points that are older than a specified number of days. Current processes are pretty tedious, requiring manual confirmation for each VM when deleting backups. If anyone has a script that they've used for this type of cleanup across multiple tenants or specific RSVs, or if you have any advice on leveraging AZRecoveryServices modules, I would really appreciate your help! Thanks a lot!
6 Answers
Just switching backup policies won't cut it if you're dealing with soft deletes and immutable vaults. Each vault might have different retention policies based on subscriptions and regulatory needs, which complicates things significantly. I wish it were as easy as just changing a setting!
You might want to look into how much these backups are costing you. It could help prioritize which data to keep and which to delete!
You might not need something complicated. Have you thought about tweaking the backup policies to be more strict? That could help automatically delete older backups. Also, the business continuity center workbooks offer a good overview of your overall setup, which might assist you in managing the current state without excessive manual work.
Have you checked if deleting a recovery vault gives you a generated script? It might not cover everything, but it could serve as a useful foundation for your cleanup solution.
Cleaning up such a huge setup sounds overwhelming! I can imagine it's not just a one-person job. Still, it's definitely possible to script actions like this. I struggle with Powershell myself, especially when it comes to dynamic context switching for multiple VM names and variables. Hope someone with more experience can jump in and share their insights. Fingers crossed for more tips!
Another option could be to restore only the data you need to another storage solution, then delete the entire vault. It’s a drastic approach, but it might save you some hassle in the long run!
Absolutely, it's a massive undertaking! I'm also hoping someone who's been through this can shed light on scripting options.