Forum Discussion

Datalife123's avatar
Datalife123
Copper Contributor
Feb 22, 2024

Azure Storage Container - Soft Delete Monitoring

Hi All, 

Can someone let me know if there is a way to export all the soft deleted items in my container on a daily basis into a csv or any file format I could connect PBI with?

I want to monitor all Active and Soft Deleted items on a Power Bi report I have created and at this moment I can't seem to find a way to get a list of all the items that have been deleted..

 

Thanks

1 Reply

  • Adeelaziz's avatar
    Adeelaziz
    Brass Contributor
    It would be great if Azure Resource Graph (ARG) could do this but unfortunately that's not available (yet).

    How about running a scheduled PowerShell job which appends to a file?

    # Set storage account context
    $mycontext = New-AzStorageContext -StorageAccountName "yourstorageaccountname" -StorageAccountKey "yourstorageaccountkey"

    # Retrieve a list of soft-deleted containers and export to CSV
    Get-AzStorageContainer -Context $mycontext -IncludeDeleted | Export-Csv -Path "C:\\path\\to\\output\\file.csv" -NoTypeInformation - Append

Resources