Remove azure fileshare with RSV backup enabled via terraform gives error of share or snapshots may have active leases

Po Cin Teo 5 Reputation points
2024-10-08T04:07:15.69+00:00

I have two recovery service vaults in two different regions, south east asia and west europe.

But I only get this error message when using terraform to destroy the azure fileshare that has snapshot inside for SEA only. I did the same testing for fileshare in west europe, no error at all.

deleting File Share "seashare" (Account "Account \"myseafileshare\" (IsEdgeZone false / ZoneName \"\" / Subdomain Type \"file\" / DomainSuffix \"core.windows.net\")"): executing request: unexpected status 409 (409 Unable to delete share because one or more share snapshots have active leases. Release the share snapshot leases or delete the share with the include-leased parameter for x-ms-delete-snapshots.) with DeleteShareWhenSnapshotLeased: Unable to delete share because one or more share snapshots have active leases. Release the share snapshot leases or delete the share with the include-leased parameter for x-ms-delete-snapshots.

Both using the same azurerm provider 3.116.0 and I created both RSV using same terraform configuration except location. Both RSV have the soft delete enabled on these properties : Enable soft delete for cloud workloads, Enable soft delete and security settings for hybrid workloads.

I am able to terraform destroy the seashare after I turn off the Enable soft delete for cloud workloads, Enable soft delete and security settings for hybrid workloads and manually delete the snapshot for the seashare.

I checked the lease on the file as well. REST file lease: State -> Available , Lock -> Unlocked

Any idea on why the behaviour could be different when they are having same RSV setting / azure fileshare setting except location?

Azure Backup
Azure Backup
An Azure backup service that provides built-in management at scale.
1,289 questions
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.
3,244 questions
{count} votes

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.