Here’s an example of how to enable the Azure Blob Data Retention Policy using the Azure portal:
- Open the Azure portal and navigate to the storage account where you want to enable the retention policy.
- In the left menu, select “Blob service.”
- Select the container for which you want to enable the retention policy.
- In the container settings menu, select “Retention policy.”
- Select “Enable retention” and specify the retention period in days or indefinitely.
- Click “Save” to save the retention policy settings.
Here’s an example of how to enable the Azure Blob Data Retention Policy using PowerShell:
- Open PowerShell and connect to your Azure account using the command:
Connect-AzAccount - Select the subscription where your storage account is located using the command:
Select-AzSubscription -SubscriptionName <subscription_name> - Get the container object using the command:
$container = Get-AzStorageContainer -ResourceGroupName <resource_group_name> -StorageAccountName <storage_account_name> -Name <container_name> - Set the retention policy using the command:
$container | Set-AzStorageContainerLegalHold -LegalHold $true -RetentionDays <retention_days>Note: Replace<resource_group_name>,<storage_account_name>,<container_name>, and<retention_days>with your own values.
