Is there a way to enable Soft delete on Storage Account through custom policy.

Manjusha Devadas 1 Reputation point
2022-07-17T11:05:59.697+00:00

Is there a way to enable Soft delete on Storage Account through custom policy.

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,275 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dillon Silzer 52,741 Reputation points
    2022-07-17T16:36:36.887+00:00

    Hello @Manjusha Devadas

    Yes, you can turn on soft deletion for storage accounts through a policy. You can do this through the portal/powershell/azure cli/template options.

    You can "[s]pecify a retention period between 1 and 365 days." PowerShell (7 days) example is included below:

    Enable-AzStorageContainerDeleteRetentionPolicy -ResourceGroupName <resource-group> `  
        -StorageAccountName <storage-account> `  
        -RetentionDays 7  
    

    Azure CLI Example (7 days):

    az storage account blob-service-properties update \  
        --enable-container-delete-retention true \  
        --container-delete-retention-days 7 \  
        --account-name <storage-account> \  
        --resource-group <resource_group>  
    

    See more information at https://learn.microsoft.com/en-us/azure/storage/blobs/soft-delete-container-enable?tabs=azure-portal

    ---------------------

    If this helps please mark as correct answer.


  2. Shekar Yenagandula 116 Reputation points
    2023-01-05T17:29:50.583+00:00

    Yes. It is.
    I'm not able to provide solution detail here.
    Suggest you to go through below link and follow the steps.
    https://github.com/shekaryenagandula/soft-delete-for-storage-accounts-through-azure-policy/tree/main

    Upvote please

    0 comments No comments