DEV Community

Cover image for Azure Management Tasks Part 6: Cleaning Up an Azure Environment the Right Way.
SULIAT
SULIAT

Posted on

Azure Management Tasks Part 6: Cleaning Up an Azure Environment the Right Way.

INTRODUCTION

Every resource in this series has served its purpose, the VM has run as an FTP server, the storage account has held files and access tokens, the network has been segmented and secured. Now it's time to remove all of it, cleanly, so nothing keeps quietly costing money after we've moved on.

Before skipping ahead: if you don't run through this cleanup, Azure will keep billing for these resources indefinitely. This part matters just as much as anything else in the series.

What You'll Need

  • Access to the Azure portal
  • The resource lock created in Part 5 (VM-delete-lock)
  • A few minutes of waiting for deletions to actually process

Step 1: Remove delete locks.

Note: If you attempt to delete a resource with a delete lock, you’ll receive a warning that the operation failed due to a delete lock being in place. To avoid that, it’s important to clear delete locks from resources you intend to delete before issuing the delete command.

  • From the Azure portal home page, in the search box, enter virtual machines.
  • Select virtual machines under services.
  • Select the guided-project-vm virtual machine. services
  • If necessary, expand the Settings submenu.
  • Select Locks.
  • Select Delete on the line for the VM-delete-lock.
  • On the pop-up window, select Delete to confirm deletion of the lock. Confirm Once the delete lock is removed, you’ll be able to delete the VM. While this was the only delete lock required by the exercise, if you applied other delete locks during the exercise, remove them now. When you’re done, select Home to return to the Azure portal home page.

Step 2: Delete the project resource group

  • From the Azure portal home page, in the search box, enter Resource groups.
  • Select resource groups under services.
  • Select the guided-project-rg resource group. Groups
  • Select Delete resource group.
  • Select Apply force delete…
  • Enter guided-project-rg in the confirmation box.
  • Select Delete.
  • On the Delete confirmation pop-up, select Delete. Delete

Step 3: Delete the NetworkWatcherRG.

  • From the Azure portal home page, in the search box, enter Resource groups.
  • Select resource groups under services.
  • Select the NetworkWatcherRG resource group.
  • Select Delete resource group.
  • Enter NetworkWatcherRG in the confirmation box.
  • Select Delete.
  • On the Delete confirmation pop-up, select Delete. Delete rg

CONCLUSION

That's everything. Across this series, we went from an empty Azure subscription to a fully functioning (if small-scale) environment: a resource group holding a VM, VNet, and storage account; a segmented network with its own security rules; a VM resized, relocated, and equipped with its own data disk; a storage account serving files through both containers and file shares, with access controlled and revocable via SAS tokens; and finally, tags and locks to keep it organized and protected before tearing it all down responsibly at the end.

Top comments (0)