Handle batch deletion of resources within RG via Tag value

Question

Okay, so I was wondering if there'd be a way of deleting resources within a resource group and skipping some of them using a tag value.

I created a script that gathers resources within that RG, loops over them, checks the tag value and attempts to delete them, however I've come across a problem:

In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet. CorrelationId: 27357980-d2d6-4b4f-8434-2463a3cf955

Which is DEPENDENCIES!

How should I handle dependent resources?

I can't control the loop order so...does anyone have any clues on the matter?

Posted Jul 23, 2026, 10:24 AM UTC

10
Loading comments…