Azure / Azure/azure-powershell

[Feature]: Please add an official Restore-AzStorageBlob cmdlet for soft-deleted blobs

Open
#23,750 7 comments 1 reaction 0 assignees View on GitHub
act-codegen-extensibility-squad customer-reported feature-request Service Attention Storage
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description of the new feature

Users are seemingly unable to have a simple Az PowerShell cmdlet to restore soft-deleted blobs on flat hierarchical namespace Storage Accounts. While we can run the following to achieve such result:

```powershell
Get-AzStorageBlob -Context $storageAccountContext -Container $containerName -IncludeDeleted `
| Where-Object { $_.IsDeleted } `
| ForEach-Object {
$_.BlobClient.Undelete()
}
```

This implementation doesn't take advantage of the `LimitedConcurrencyTaskScheduler` implementation used by other Az PowerShell Storage cmdlets like `Remove-AzStorageBlob` and would be ultimately much slower when recovering soft-deleted blobs in the order of millions.

### Proposed implementation details (optional)

The cmdlet can be used to simplify soft-deleted blobs by making calls such as:

```powershell
Get-AzStorageBlob -Context $storageAccountContext -Container $containerName -IncludeDeleted `
| Where-Object { $_.IsDeleted } `
| Restore-AzStorageBlob
```

Contributor guide

Open the contributing guide

Research direction

Read the implementation of Remove-AzStorageBlob and its LimitedConcurrencyTaskScheduler usage, then compare it with the Get-AzStorageBlob deleted-blob pipeline and the BlobClient.Undelete() example. Done means an official Restore-AzStorageBlob accepts the proposed pipeline and restores soft-deleted blobs at scale using the existing concurrency approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, powershell
Domain
cli, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.