3.1.3.4. Configure Snapshots and Soft Delete for Azure Files
3.1.3.4. Configure Snapshots and Soft Delete for Azure Files
💡 First Principle: Two different mistakes need two different safety nets. Someone overwrites or deletes a file: you need an earlier point-in-time copy of the share's contents. Someone deletes the whole share: you need the share itself held back from permanent deletion. Share snapshots answer the first, and share soft delete answers the second.
Scenario: A design team keeps its project files on an Azure file share. Before every major application release, the operations team wants a restore point it can roll individual files back to. Last quarter an administrator deleted the wrong share during a cleanup, and the company now wants a guaranteed window to bring a deleted share back.
What It Is: A share snapshot is a read-only, point-in-time copy of an entire file share, available for SMB and NFS shares. Soft delete for Azure file shares keeps a deleted share in a recoverable deleted state for a retention period before it is permanently removed.
Share Snapshots: How They Behave:
- Share level, file restore. You take a snapshot of the whole share, never of a single file, but you can restore individual files or folders from it, or copy the whole share back file by file.
- Incremental. Only data changed since the previous snapshot is stored, so you pay only for the changed content. Snapshots don't count toward the share's size quota.
- Read-only. You can read, copy or delete a snapshot, but never modify it. Restoring copies data back to the live share; the snapshot itself is never promoted.
- Limits. Up to 200 snapshots per share, retained for up to 10 years. At 200, you must delete older snapshots before you can create new ones.
- Tied to the share. You can't delete a share and keep its snapshots: deleting the share deletes its snapshots too. Snapshots also don't protect against deleting the share or the storage account.
- Same redundancy as the share. On a geo-redundant account, snapshots are stored in the paired region as well.
Restoring from a snapshot:
- Azure portal: open the file share, select Snapshots, open a snapshot, right-click the file and choose Restore, then Overwrite original file.
- Windows client: on a mounted SMB share, right-click a file or folder, select Properties > Previous Versions, and open or restore the version you need, just like Volume Shadow Copy on a file server.
- Linux client: mount a specific SMB snapshot with the
snapshot=@GMT-...mount option, or browse the hidden.snapshotsdirectory on an NFS share.
Soft Delete for File Shares:
- Account-level setting, share-level protection. You enable it once on the storage account, and it applies to every file share in the account. It protects whole shares only; a deleted file inside a live share is not covered (use snapshots or Azure Backup for that).
- On by default for new storage accounts. The default retention is 7 days, and you can set 1 to 365 days. A changed retention period applies only to shares deleted after the change.
- Undelete restores everything. Undeleting a share brings back the share and all of its contents, including its snapshots, as they were before deletion. In the portal, turn on Show deleted shares and select Undelete.
- Still billed. A soft-deleted share is charged according to the share's billing model until it expires, and a provisioned share's quota still counts toward the account until then.
- Purging early takes three steps. To permanently remove a soft-deleted share before it expires, undelete it, disable soft delete, and delete it again (then re-enable soft delete for the other shares).
How Azure Backup Builds on Both: Azure Files backup uses a Recovery Services vault and a backup policy to schedule the same share snapshots for you and manage their retention. In the snapshot tier, recovery points are share snapshots stored in the storage account, and the vault keeps only references to them; the vault-standard tier also copies changed data into the vault for offsite protection. When you protect a share, Azure Backup enables share soft delete on the storage account with a 14-day retention and takes a lease on the snapshots it creates, so they can't be deleted accidentally. Azure Backup doesn't support NFS file shares, so NFS shares rely on manual snapshots.
Practical Implementation: Snapshots and Soft Delete with Azure CLI
# Take a share snapshot before a release
az storage share snapshot --name designfiles --account-name contosofiles
# List shares together with their snapshots
az storage share list --account-name contosofiles --include-snapshots
# Turn on share soft delete with a 30-day retention period
az storage account file-service-properties update \
--resource-group rg-files \
--account-name contosofiles \
--enable-delete-retention true \
--delete-retention-days 30
# Find and restore a soft-deleted share
az storage share-rm list --resource-group rg-files \
--storage-account contosofiles --include-deleted
az storage share-rm restore --name designfiles \
--deleted-version <deleted-version> \
--resource-group rg-files --storage-account contosofiles
Visual: Which Safety Net Recovers What
⚠️ Common Pitfall: Treating snapshots as protection against deleting the share. Snapshots live inside the share and are deleted with it, so without soft delete one wrong delete removes the data and every restore point.
⚠️ Exam Trap: Match the recovery tool to the object. A deleted or overwritten file is recovered from a share snapshot (or an Azure Backup recovery point), not from soft delete. A deleted share is recovered with soft delete, which also brings its snapshots back. Blob soft delete is a different setting and doesn't protect file shares.
Key Trade-Offs:
- Recovery Window vs. Cost: Longer soft-delete retention and more snapshots give more recovery options, but both are billed while they exist.
- Manual vs. Managed Snapshots: Manual snapshots avoid the Azure Backup protected-instance fee but need someone to schedule and prune them; Azure Backup automates schedule and retention for that fee.
Reflection Question: If a ransomware script deletes every file inside a share and then deletes the share itself, which settings would you need to have enabled beforehand to recover both the share and the files as they were yesterday?