Forum Discussion
Datalife123
Feb 22, 2024Copper Contributor
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 moni...
Adeelaziz
Apr 05, 2024Brass 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
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