About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
windows_first
⚠️
powershell_heavy
⚠️
windows_tools
Summary:
The documentation demonstrates a moderate Windows bias. PowerShell is given equal or greater prominence than Azure CLI, and is always listed before CLI in tabbed sections. Instructions for using the Azure CLI reference opening a 'Windows PowerShell' console, and there is no explicit mention of Linux or macOS terminals. The Azure Portal is platform-agnostic, but the overall pattern and language favor Windows tools and workflows.
Recommendations:
- Alternate the order of PowerShell and Azure CLI sections, or present CLI first to avoid always privileging Windows-native tools.
- In CLI instructions, explicitly mention that commands can be run from Bash or other Linux/macOS terminals, not just Windows PowerShell.
- Wherever 'Windows PowerShell' is referenced as a console, add 'or a Bash terminal on Linux/macOS' to clarify cross-platform compatibility.
- Add explicit notes or examples for Linux/macOS users where command-line instructions are given, especially for authentication and environment setup.
- Consider including screenshots or terminal prompts that reflect both Windows and Linux environments.
Create pull request
Flagged Code Snippets
Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName <resource-group> `
-StorageAccountName <storage-account> `
-RetentionDays 7
$properties = Get-AzStorageBlobServiceProperty -ResourceGroupName <resource-group> `
-StorageAccountName <storage-account>
$properties.DeleteRetentionPolicy.Enabled
$properties.DeleteRetentionPolicy.Days
2. Install **Az.Storage** preview module.
5. To check the current settings for blob soft delete, use the `Get-AzStorageServiceProperty` command:
1. Specify the retention period. The default value is 7.
1. Save the template.
1. Specify the resource group of the account, and then choose the **Review + create** button to deploy the template and enable container soft delete.
---
## Enable blob soft delete (hierarchical namespace)
Blob soft delete can also protect blobs and directories in accounts that have the hierarchical namespace feature enabled on them.
<a id="enable-blob-soft-delete-hierarchical-namespace"></a>
### [Portal](#tab/azure-portal)
To enable blob soft delete for your storage account by using the Azure portal, follow these steps:
1. In the [Azure portal](https://portal.azure.com/), navigate to your storage account.
1. Locate the **Data Protection** option under **Data Management**.
1. In the **Recovery** section, select **Enable soft delete for blobs**.
1. Specify a retention period between 1 and 365 days. Microsoft recommends a minimum retention period of seven days.
1. Save your changes.
> [!div class="mx-imgBorder"]
> 
### [PowerShell](#tab/azure-powershell)
1. Install the latest **PowershellGet** module. Then, close and reopen the PowerShell console.
For more information about how to install PowerShell modules, see [Install the Azure PowerShell module](/powershell/azure/install-azure-powershell)
3. Obtain storage account authorization by using either a storage account key, a connection string, or Microsoft Entra ID. For more information, see [Connect to the account](data-lake-storage-directory-file-acl-powershell.md#connect-to-the-account).
The following example obtains authorization by using a storage account key.
4. To enable blob soft delete with PowerShell, use the [Enable-AzStorageDeleteRetentionPolicy](/powershell/module/az.storage/enable-azstoragedeleteretentionpolicy) command, and specify the retention period in days.
The following example enables soft delete for an account, and sets the retention period to 4 days.
### [Azure CLI](#tab/azure-CLI)
1. Open the [Azure Cloud Shell](../../cloud-shell/overview.md), or if you've [installed](/cli/azure/install-azure-cli) the Azure CLI locally, open a command console application such as Windows PowerShell.
2. Install the `storage-preview` extension.