How to remove a resource lock from app-share?

Cedric Flemming 20 Reputation points
2024-05-16T22:19:43.89+00:00

I am trying to delete app-share in my storage account. I get the following error. Documentation is not clear to me. Any suggestions.?

Share can't be deleted

A resource lock affects this share. Resource locks can exist on the subscription, resource group and storage account level. They are used to prevent accidental changes or resource deletions.

To force deletion, remove the lock and attempt share deletion again.

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,779 questions
0 comments No comments
{count} votes

Accepted answer
  1. Nehruji R 3,121 Reputation points Microsoft Vendor
    2024-05-17T08:23:00.87+00:00

    Hello Cedric Flemming,

    Greetings! Welcome to Microsoft Q&A Platform.

    It appears that you’re encountering an issue when trying to delete an Azure File Share from your storage account. The error message indicates that the file share is impacted by a resource lock.

    In order to delete the file share, you need to remove the lock first and then try to delete the Azure File Share. To delete the storage lock, please check whether the lock is applied to a single storage account or a resource group, and then proceed with the deletion operation accordingly. The below article explains more about types of resource locks. https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources?tabs=json#considerations-before-applying-your-locks

    Select storage account -> Settings -> Locks -> To delete the lock, select the Delete button.

    Delete lock.

    https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources?tabs=json#configure-locks

    Can you check any other client accessing the share? Create another test file in the same storage account (file share) for testing purpose and see are facing the similar issue?

    Azure - Clearing the lock on a file within an Azure File Share Based on the error message you may refer to this article: https://learn.microsoft.com/en-us/rest/api/storageservices/managing-file-locks which provides detailed information on file locks Try to Unlock all Azure file share locks This article lists common problems that are related to Microsoft Azure Files when you connect from Windows clients. It also provides possible causes and resolutions for these problems. In addition to the troubleshooting steps in this article: Unable to delete files Sharing violation

    Additional details: Cannot delete full directory structure from Directory in File Share deleting non empty directory in fileshare in azure storage.

    Hope this answer helps! Please let us know if you have any further queries. I’m happy to assist you further.


    Please "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Amrinder Singh 3,560 Reputation points Microsoft Employee
    2024-05-17T02:30:12.45+00:00

    Hi Cedric Flemming - thanks for reaching out.

    There seem to be a lock created on the storage account and leading to the same. It is also quite possible that the lock is created as part of some kind of backup policy configured and that too shall get listed via similar process.

    You can view the locks by navigating via below process

    Select storage account -> Settings -> Locks

    Below is the ref documentation for the same.

    https://learn.microsoft.com/en-us/azure/storage/common/lock-account-resource?tabs=portal

    https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources?tabs=json

    I am sharing another Q&A ref that could be helpful with the steps as well:

    https://learn.microsoft.com/en-us/answers/questions/1455224/unable-to-delete-file-share-due-to-azurebackupprot

    Please let us know if you have any further queries. I’m happy to assist you further.    


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.
    0 comments No comments