Want to Avoid Accidently Deleting your Resources in Azure? It's Easier Than You Think
Published Feb 23 2023 01:34 PM 6,236 Views

The most important point is when you are deleting any of the Resource Groups, all the resources belonging to that particular Resource Group along with the Resource Group will get deleted permanently. So, you must be very much careful before deleting any of the resource Groups. 

Make sure before deleting the Resource Group, that you are reading the warning message that says below. 


“Warning! Deleting the “demogroup” resource group is irreversible. The action you’re about to take can’t be undone. Going further will delete this resource group and all the resources in it permanently.” 





So, note that it is not possible to recover or restore a deleted Resource Group in Azure. The action can’t be undone and is an irreversible action. 


But to avoid this scenario in the future all you need to do is identify all the important Resource Groups that contain critical Azure resources and then Lock those Resource Groups. 

As an administrator, you can lock an Azure subscription, resource group, or resource to protect them from accidental user deletions and modifications. The lock overrides any user permissions. 

You can set locks that prevent either deletions or modifications. In the portal, these locks are called Delete and Read-only 



To Lock your Azure Resource Groups, you just need to follow the below quick instructions. 

  1. Log in to the Azure Portal. 
  2. Search for Resource Groups and click on the search result Resource Groups.   rtripurani_1-1677186192712.png
  3. Now, you will be able to see the lists of Resource Groups that you have created. Click on the specific Resource Group that you wish to Lock. 




  1. On the Resource Group page, click on the Locks link from the left navigation that is present under Settings. 




  1. Click on the + Add button to create a Lock for that Resource Group you wish to delete. 




  1. On the Add lock window, Provide the below details. 




  • Lock name: Provide a meaningful name for your Lock. 
  • Lock type: Select the Lock type read-only or delete based on your requirement. 
  • Notes: Provide a note which is optional. 

    Click on the Ok button to create the Lock. 




  1. Now when you will try to delete the Resource Group, it won’t allow you and will show you a message 




“The Resource Group is locked and can’t be deleted. Click here to manage locks for this Resource Group.” 

  1. To edit/remove the lock, select the edit/delete button. rtripurani_8-1677186192725.png


This way you can protect your Azure Resource Group from an accidental deletion or modification in Azure Portal. 

Once a resource has been locked, the resource lock must first be removed before the resource can be modified or deleted.


How to recover deleted Resource Group Azure 

You can just try the following as a workaround. 

  • You can try raising a ticket to Microsoft to restore it back. Provide as much detail as you can about the deleted resources, including their resource IDs, types, and resource names.  Note: Recovery of deleted resources is not possible under all circumstances. A support engineer will investigate your scenario and advise you whether it's possible.
  • Some resource types support soft delete. You might have to configure soft delete before you can use it. For more information about enabling soft delete, see the documentation for Azure Key VaultAzure Backup, and Azure Storage.



1 Comment
Version history
Last update:
‎Jan 26 2024 10:34 AM
Updated by: