Published on

February 10, 2022

Preventing Accidental Resource Deletion in Azure Data Factory with Locks

Introduction

When working in Azure Data Factory, it is possible for a user to accidentally delete a resource. To prevent this, we can implement Azure Locks. Azure Locks allow us to create restrictions and prevent accidental resource deletion. This is particularly useful in production environments where developers or administrators may have full access and could unintentionally delete important resources.

Lock Levels

There are two types of lock levels available in Azure Data Factory: CanNotDelete and ReadOnly.

  • CanNotDelete: Authorized users are able to read and modify resources, but they cannot delete them. In the portal, this lock is referred to as “Delete”.
  • ReadOnly: Authorized users can only read a resource, they cannot delete or modify it. In the portal, this lock is referred to as “Read-only”.

Access Required

In order to create or manage locks, you need to have the following access:

  • Must be an owner or User Access Administrator with built-in roles.
  • Must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/*.

Create a New Lock

To create a new lock in Azure Data Factory, follow these steps:

  1. Go to the settings option in Azure Data Factory.
  2. Look for the “Locks” entry in the menu.
  3. Click on “Add” to create a new lock.
  4. Provide a lock name.
  5. Choose the lock type between “Read-only” and “Delete”.
  6. Add any optional notes or comments about the lock.

Managing Locks

Once a lock is created, it will be available in the Lock section. From there, you can edit or delete existing locks as needed.

Preventing Resource Deletion

Let’s say you have a demo pipeline called “Pl_Test” in your data factory and you want to prevent it from being accidentally deleted. You can apply a lock to this resource. When you try to delete the pipeline, you will receive an error message indicating that the resource is locked. You will need to remove the lock or undo the delete action in order to proceed.

Conclusion

In this article, we have learned how to use locks in Azure Data Factory to prevent accidental resource deletion. By implementing locks, we can add an extra layer of protection to our resources and minimize the risk of unintentional deletions.

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.