# 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)

{% stepper %}
{% step %}

### 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.
   {% endstep %}

{% step %}

### PowerShell — enable soft delete

Update FileService properties (replace and ):

{% code title="Enable soft delete (PowerShell)" %}

```powershell
$resourceGroupName = "<resource-group>"
$storageAccountName = "<storage-account>"

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

{% endcode %}
{% endstep %}

{% step %}

### Azure CLI — enable soft delete

Replace variables as needed:

{% code title="Enable soft delete (Azure CLI)" %}

```bash
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
```

{% endcode %}
{% endstep %}
{% endstepper %}

How to restore a soft-deleted file share

{% stepper %}
{% step %}

### 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.
   {% endstep %}

{% step %}

### PowerShell — list and restore

List deleted shares (to get -DeletedShareVersion):

{% code title="List deleted shares (PowerShell)" %}

```powershell
Get-AzRmStorageShare `
    -ResourceGroupName $resourceGroupName `
    -StorageAccountName $storageAccountName `
    -IncludeDeleted
```

{% endcode %}
{% endstep %}

{% step %}

### Azure CLI — list and restore

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

{% code title="List deleted shares (Azure CLI)" %}

```
```

{% endcode %}

```bash
az storage share-rm list \
    --resource-group $resourceGroupName \
    --storage-account $storageAccountName \
    --include-deleted
```

Restore a share:

```bash
az storage share-rm restore -n deletedshare --deleted-version 01D64EB9886F00C4 -g yourResourceGroup --storage-account yourStorageaccount
```

(Replace names and version with values from your account.)
{% endstep %}
{% endstepper %}

How to disable soft delete

{% stepper %}
{% step %}

### 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.
   {% endstep %}

{% step %}

### PowerShell — disable soft delete

{% code title="Disable soft delete (PowerShell)" %}

```powershell
Update-AzStorageFileServiceProperty `
    -ResourceGroupName $resourceGroupName `
    -StorageAccountName $storageAccountName `
    -EnableShareDeleteRetentionPolicy $false
```

{% endcode %}
{% endstep %}

{% step %}

### Azure CLI — disable soft delete

{% code title="Disable soft delete (Azure CLI)" %}

```bash
az storage account file-service-properties update \
    --resource-group $resourceGroupName \
    --storage-account $storageAccountName \
    --enable-delete-retention false
```

{% endcode %}
{% endstep %}
{% endstepper %}

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.
