You can lock your Azure Resource Group using the steps below to avoid accidental deletion.
1. Log in to Azure Portal.
2. Search for Resource Group and then click on the search result Resource Group, as shown in the screenshot below.

3. Click on the specific Resourcerce Group to apply the lock.

4. On the Resource Group page, expand settings, click on Locks, then click on the + Add button, Provide a name for the lock, choose the lock type, specify a note, and finally, click the OK button as shown in the screenshot below.

Now, you can see in the screenshot below that the lock was created successfully.

When I clicked the Delete resource group button to delete the resource group, it didn’t allow me.

It showed me a message saying that the Delete resource group failed; the Resource group is locked and can’t be deleted. Check out the screenshot below for your reference.

Video Tutorial
You may also like following the articles below.

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
