

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to enable soft delete for Azure Storage blobs using Azure CLI in Powershell?
From the Azure portal, we need to access the Data Protection property of the Azure Storage account.
To enable soft delete using Az CLI, you first need to install the storage-preview extension with the below command.
az extension add -n storage-preview
Once the extension is installed, you need to make sure that you are connected to the Azure Account (if not then use “az login”) command and the proper azure subscription (using “az account set”).
To enable soft delete with Azure CLI use the below command.
az storage fs service-properties update
We can use this command with Key, connection string, or SAS token. Here, we will use the connection string. To retrieve the connection string, use the below command.
$rg = 'az204' $strgaccount = 'az204storage05june' $connectionstring = az storage account show-connection-string -g $rg - n $strgaccount -otsv
To enable the soft delete with 10 days of the retention period, use the below command.
az storage fs service-properties update ` --delete-retention ` --delete-retention-period 10 ` --account-name $strgaccount ` --connection-string $connectionstring
You can also use the storage account key instead of the connection string as shown below.
az storage fs service-properties update ` --delete-retention ` --delete-retention-period 10 ` --account-name $strgaccount ` --account-key $storageaccountkey
- Related Questions & Answers
- How to enable soft delete for Azure Storage blobs using PowerShell?
- How to get the Azure storage container blobs (files) using Azure CLI in PowerShell?
- How to delete the azure blob (File) using Azure CLI in PowerShell?
- How to get the Azure storage container blobs (Files) using PowerShell?
- How to open port for the Azure VM using Azure CLI in PowerShell?
- How to list the Azure VMs using Azure CLI in PowerShell?
- How to deallocate the Azure VM using Azure CLI in PowerShell?
- How to stop the Azure VM using Azure CLI in PowerShell?
- How to start the Azure VM using Azure CLI in PowerShell?
- How to restart the Azure VM using Azure CLI in PowerShell?
- How to resize the Azure VM using Azure CLI in PowerShell?
- How to connect to the Azure subscription using Azure CLI in PowerShell?
- How to get the Azure VM Size using Azure CLI in PowerShell?
- How to get the Azure resource group using Azure CLI in PowerShell?
- How to get the Azure VM username using Azure CLI in PowerShell?