Schedule Azure Resource Deletion using Azure DevOps

1 min read

Summary

Delete unwanted experimental or PoC work easily by using Azure DevOps build pipelines set on a scheduled trigger.

The following script deletes Resource Groups and all resources contained within that Resource Group.

az group delete --name <resourceGroupName> --yes

The build pipeline uses the official Azure Cli Task. Below, I’m running the task on a Dev/Test Subscription.

You can also set the trigger to run multiple times in a day/week. Here I have set my Trigger to run every night, at midnigt.

This is an effective way to remove experimental or PoC resources. Together with Azure Templates, it makes the IaC easier to manage.

You must be logged in to post a comment.