Azure Locks

At times, Azure resource groups could be accidentally deleted by some users inadvertently, in order to get around this problem Resource groups locks can be set up, they could be set up different parent levels – At subscription levels, Resource Groups levels or Resource level’s etc. Locks can be created either using Azure portal or Power shell.

  • Using portal, you can use the following approach. For instance, if you have created a resource group you can navigate to the locks section in the left menu and click on Add button to create a lock. Here I created a resource group named “testmappingdataflows”, and navigated to Locks in settings to create a lock to disable deletion as outlined below. 
  • Using Powershell, you can use create and apply locks using the following command:
New-AzureRmResourceLock -LockLevel CanNotDelete -LockName criticalStorageLock -ResourceName criticalstorageaccount1 -ResourceType Microsoft.Storage/storageAccounts -ResourceGroupName CriticalStorageRG

Locks is a very useful feature to restrict accidental deletion.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.