"What's the best way to prevent accidental deletion of critical Azure resources while still allowing necessary modifications?"

24a31a44e0 0 Reputation points
2025-02-13T12:55:23.46+00:00

I want to prevent the accidental deletion of critical Azure resources, such as virtual machines, storage accounts, or databases. I need a solution that ensures these resources cannot be deleted unintentionally while still allowing necessary updates.

This question is related to the following Learning Module

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
2,259 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RNareddy 2,265 Reputation points Microsoft External Staff
    2025-02-13T16:28:55.52+00:00

    Hello @24a31a44e0 ,

    Thank you for posting your query on the Microsoft Q&A forum.

    Azure Resource Locks help prevent accidental deletion of critical resources while allowing necessary updates.

    Types of Locks:

    • CanNotDelete (Delete Lock): Allows modifications but blocks deletions.
    • ReadOnly (Read-Only Lock): Allows viewing but prevents modifications and deletions.

    How to Apply a Resource Lock:

    1. Go to Azure Portal: Select the resource you want to protect.
    2. Open Locks: Find “Locks” under the resource’s settings.
    3. Create a Lock: Add a new lock, choose the type, and provide a name.
    4. Save: The lock will be applied, affecting any child resources.

    Key Points:

    • Inheritance: Locks at the parent level apply to all child resources.
    • Control Plane Only: Locks apply to management actions, not data operations.

    Resource locks are a simple and effective way to safeguard your Azure resources from accidental changes.

    Reference doc: Lock your Azure resources to protect your infrastructure - Azure Resource Manager | Microsoft Learn

    Please reach out to us if you have any other queries.

    Kindly Accept Answer and Upvote if it has been helpful.

    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.