Scheduled Sandbox Cleanup in Azure.

Valur Marvin Pálsson 1 Reputation point
2022-12-07T11:14:23.93+00:00

Hey, is there a way to cleanup/delete all resources in the Sandbox subscription automatically, on a weekly basis?

Best regards

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
40,368 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Sam Cogan 10,757 Reputation points MVP
    2022-12-07T12:35:46.417+00:00

    There is nothing built in, you would need to create a script using something like Azure automation to do this for you.

    0 comments No comments

  2. Nico Marino 31 Reputation points
    2022-12-07T14:15:10.46+00:00
    0 comments No comments

  3. Luke Murray 11,241 Reputation points MVP
    2022-12-08T02:27:04.247+00:00

    You would need to setup an Azure Automation runbook, on a schedule to delete your resources,.

    Jack Tracey - has published a script: https://github.com/jtracey93/PublicScripts/tree/master/Azure/PowerShell/Enterprise-scale

    This script will remove everything under a management group and everything in the subscriptions, it can also remove SPNs and reset Cloud for Defender pricing back to Free.

    Its a nuclear option - but very useful in sandbox environments.

    THIS SCRIPT WILL REMOVE EVERYTHING IN A MANAGEMENT GROUP - so please be careful - and TEST it in a non-production environment.

    0 comments No comments

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.