I cannot delete the snapshots from my Azure ML-linked fileshare because it says I am under lease, but there is no lease on that fileshare?

Anjali Tangirala 0 Reputation points
2025-03-04T18:37:23.3333333+00:00

I deleted a substantial amount of storage from my fileshare, as well as deleted other fileshares entirely, due to cost reasons, but now I am unable to delete the snapshots taken by Azure Backup because they say it is under lease, but I see no Lease when querying with the Azure CLI. Additionally, I believe they are contributing to the increase in storage, and therefore the resource used.

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,420 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Venkatesan S 2,820 Reputation points Microsoft External Staff Moderator
    2025-03-17T16:08:26.11+00:00

    Hi @Anjali Tangirala

    According to this MS-Document

    We recommend you perform the stop protection with delete data operation on the backed-up file share. After this operation, Azure Backup will release the lease and delete all snapshots. Then you can delete the file share.

    You can use this Azure CLI command it will show the lease status of all shares including snaphots.

     az storage share list --account-name xxxx --include-snapshots --query "[?lease.state=='leased'].[name, snapshot]" --output table
    

    Output:

    Column1    Column2
    ---------  ----------------------------
    share1     2025-02-14T20:31:45.0000000Z
    share1     2025-02-15T20:31:41.0000000Z
    share1     2025-02-16T20:31:48.0000000Z
    share1     2025-02-17T20:30:42.0000000Z
    share1     2025-02-18T20:31:50.0000000Z
    share1     2025-02-19T20:31:03.0000000Z 
    

    enter image description here

    To delete the snapshots with azure file share you can use the below command:

    Command:

    az storage share delete --name xxx --account-name xxx --delete-snapshots include-leased  
    

    Output:

    {
      "deleted": true
    }
    

    enter image description here

    The above command will delete the file share with lease snapshots.

    Reference:

    The above link is useful to do with Azure REST API.

    Hope this answer helps! 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.


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.