1

So here’s the scoop... I have a large list of over 3000+ resources across multiple subscriptions and dev/production tenants that I need to clean up. These are all sorts of resources including storage, storage accounts, LogAnalytics, Azure App Service plans/ App Services, VMs, and many more. Phase 1 is to just simply turn off / break the services slightly to see if we can get the resource owners to claim the resources, so we don’t immediately want to go to deleting anything just yet. Then after a predetermined amount of time that we give them to claim the resources, any unclaimed will be deleted. I’ve got until the end of the month to get these 3000+ services temporarily interrupted, does anyone have any ideas on what’s i can do to interrupt them, a quick way to get the ones that are claimed back up and running, and then a deletion process for the unclaimed resources? Thanks in advance!!!!

1 Answers1

2

First off, I would be using tags on resources to indicate their current status, claimed, unclaimed, who claimed them etc. That way any automation you build to can hang off those tags and only impact unclaimed resource etc. Once a resource is claimed, update the tag to show this and who the owner is so you don't have this issue in future.

Deleting unclaimed resources is fairly straightforward; you could run some PowerShell either locally or using Azure Automation to delete any resources that do not have a claimed tag or similar.

Interrupting resources is going to be the harder task, as each resource type has a different method for stopping or disabling. Do you have a good idea of what the makeup of your resources is? If not, you can use resource graph to get this information and focus on the main bulk of resource types. Most commonly this will be VM's, databases and Web Apps so you could then write some PS to go through and turn these off.

Sam Cogan
  • 38,158
  • 6
  • 77
  • 113