Share via

How to delete a file share that's within a lock protected storage account?

MichaelB-2136 150 Reputation points
2026-04-01T14:59:25.8733333+00:00

Hi, based on the discussion on my previous question here i set up a new, empty test file share so I could restore another one of my in-use file shares to the new empty one, to ensure the backups were working correctly.

I have done this and verified the data successfully, but when attempting to delete the new file share i'm met with a message that it's protected via a lock. When I navigate to my storage account there is a lock called AzureBAckupProtectionLock that auto applies to any storage account connected to a Vault which mine is.

So how do I delete the new file share that i'm no longer in need of? Thanks

Azure Backup
Azure Backup

An Azure backup service that provides built-in management at scale.


1 answer

Sort by: Most helpful
  1. Q&A Assist
    2026-04-01T14:59:42.53+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Azure Backup applies a delete lock (AzureBackupProtectionLock) on the storage account to prevent accidental deletion of the account and any file shares in it. Because of this lock, deleting the test file share directly is blocked.

    To delete the unneeded file share, use one of these approaches:

    1. Remove or change the storage account lock
      • Go to the storage account in the Azure portal.
      • Open Locks.
      • Either remove the AzureBackupProtectionLock or change it from a delete lock to a read lock (if currently a modify/delete lock), depending on what is configured.
      • After the delete restriction is removed, delete the file share (for example, via File shares → select share → Delete share, or using Remove-AzRmStorageShare / az storage share-rm delete).
      • Be aware that removing or loosening the lock temporarily exposes the storage account and all file shares to possible accidental deletion.
    2. Remove locks/leases created by value-added services
      • Azure Backup and other services may also place share leases or additional locks on specific file shares or snapshots.
      • Follow the guidance in the Azure Files troubleshooting article to remove resource locks and leases that block modification or deletion of the share. This may involve running the provided PowerShell script that removes all resource locks and leases on the storage account and its file shares.
      • After locks/leases are removed, delete the test file share.

    Note: Removing locks or leases that Azure Backup uses can affect backup and restore operations and may allow deletion of protected shares or snapshots. Review backup requirements before permanently changing locks.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.