Azure file share soft delete

Summary β€” Azure file share soft-delete

What it is

  • Soft delete for Azure Files preserves deleted file shares for a configurable retention period so they can be undeleted (restored) along with their contents and snapshots.

  • Soft delete is enabled at the storage account (FileService) level and applies to all file shares in that account.

  • Default retention is 7 days; you can set any value from 1 to 365 days. The retention clock starts when a share is deleted.

  • To permanently delete a soft-deleted share before expiry you must: undelete it, disable soft delete, then delete the share again.

  • For provisioned (quota-based) file shares, the provisioned quota is counted against the storage account until the soft-deleted share fully expires.

  • Soft delete protects shares only (not individual files). To restore deleted files, use share snapshots or Azure file share backup.

Applies to

  • Various management/billing/redundancy combinations are supported (see original table). SMB support varies by SKU and redundancy. (Original table retained in source.)

Billing

  • Billing behavior depends on billing model. See the original links:

    • Provisioned v2 soft-delete

    • Provisioned v1 soft-delete

    • Pay-as-you-go soft-delete

How to toggle soft delete (enable)

1

Portal β€” enable soft delete

  1. Sign in to the Azure portal.

  2. Go to your storage account > Data storage > File shares.

  3. Select the Soft delete toggle and set to Enabled for all file shares.

  4. Set "File share retention period in days" (1–365) and Save.

2

PowerShell β€” enable soft delete

Update FileService properties (replace and ):

Enable soft delete (PowerShell)
$resourceGroupName = "<resource-group>"
$storageAccountName = "<storage-account>"

Update-AzStorageFileServiceProperty `
    -ResourceGroupName $resourceGroupName `
    -StorageAccountName $storageAccountName `
    -EnableShareDeleteRetentionPolicy $true `
    -ShareRetentionDays 7
3

Azure CLI β€” enable soft delete

Replace variables as needed:

Enable soft delete (Azure CLI)
resourceGroupName="<resource-group>"
storageAccountName="<storage-account>"

az storage account file-service-properties update \
    --resource-group $resourceGroupName \
    --account-name $storageAccountName \
    --enable-delete-retention true \
    --delete-retention-days 7

How to restore a soft-deleted file share

1

Portal β€” restore

  1. In the storage account, go to File shares and enable "Show deleted shares".

  2. Select the deleted share and choose "undelete".

  3. Confirm the share status becomes Active.

2

PowerShell β€” list and restore

List deleted shares (to get -DeletedShareVersion):

3

Azure CLI β€” list and restore

List deleted shares (to get --deleted-version):

Restore a share:

(Replace names and version with values from your account.)

How to disable soft delete

1

Portal β€” disable soft delete

  1. In the storage account, go to File shares under Data storage.

  2. Set Soft delete to Disabled for all file shares.

  3. Save.

  4. Note: To permanently delete a currently soft-deleted share, first undelete it, then disable soft delete, then delete it again.

2

PowerShell β€” disable soft delete

3

Azure CLI β€” disable soft delete

Important notes and links

  • Soft delete is at the share level only. For file-level recovery use share snapshots or Azure File Share Backup.

  • Soft delete settings apply to all shares in the storage account; disabling soft delete does not prevent undelete of shares deleted prior to disabling (they can still be undeleted until their expiry).

  • Billing differs by billing model; see the linked billing pages in the original article.

  • For preventing deletion/modification of the storage account itself, see the resource lock links in the original page.

Images and full command examples are available in the original article (links retained). Last updated in source: 07/31/2025.

Was this helpful?