Azure Files offers soft delete for file shares so that you can easily recover your data when it's mistakenly deleted by an application or other storage account user. To learn more about soft delete, see How to prevent accidental deletion of Azure file shares.
Navigate to your storage account and select File shares under Data storage.
Select Disabled next to Soft delete. The Soft delete settings pane will appear.
Select Enabled for Soft delete for all file shares.
Under File share retention period in days, use the slider to specify a number between 1 and 365 days.
Select Save to confirm your data retention settings.
To enable soft delete, you must update the settings for all Azure file shares, also known as the FileService properties. The following example enables soft delete for all file shares in a storage account. Remember to replace <resource-group> and <storage-account> with the appropriate values for your environment.
To enable soft delete, you must update a file client's service properties. The following example enables soft delete for all file shares in a storage account. Remember to replace <resource-group> and <storage-account> with the appropriate values for your environment.
Navigate to your storage account and select File shares.
On the file share blade, enable Show deleted shares to display any shares that have been soft deleted.
This will display any shares currently in a Deleted state.
Select the share and select undelete. This will restore the share.
You can confirm the share is restored since its status switches to Active.
To restore a soft deleted file share, you must first get the -DeletedShareVersion value of the share. To get that value, use the following command to list out all the deleted shares for your storage account.
Once you've identified the share you'd like to restore, you can use it with the following command to restore it:
Restore-AzRmStorageShare `
-ResourceGroupName $resourceGroupName `
-StorageAccountName $storageAccountName `
-DeletedShareVersion 01D5E2783BDCDA97 # replace with your deleted version number
To restore a soft deleted file share, you must first get the --deleted-version value of the share. To get that value, use the following command to list out all the deleted shares for your storage account.
az storage share-rm list \
--resource-group $resourceGroupName \
--storage-account $storageAccountName \
--include-deleted
Once you've identified the share you'd like to restore, you can restore it with the following command:
If you want to stop using soft delete, follow these instructions. To permanently delete a file share that's been soft deleted, you must undelete the share, disable soft delete, and then delete the share again.