I have a file with multiple blobs that exist in a container.
I can delete them one by one by calling in a loop:
az storage blob delete
For me that solution would be fine if there is a way just to send the request and not having to wait if it’s successful or not.
Now it takes forever to complete.
Is there a solution to have a deleteAsync or any other more performant solution to delete lists of blobs?
2
Answers
I have just check
az storage blob delete
command not support--no-wait
which help avoid waiting long-running to finish, also same as the features in az powershell-AsJob
, samples:az powershell:
New-AzResourceGroupDeployment -ResourceGroupName "xxx" -TemplateObject "xxx" -TemplateParameterFile "xxx" -AsJob
az cli:
az group deployment create -g 'xx' --template-uri 'xx' --parameters 'xx' --no-wait
I’m not familiar with bash syntax, but if you can use powershell, it’s not hard to do it here, we can leverage
start-job
to manually run command as jobs to avoid waiting.I agree with wenbo’s point but,there is a more efficient way to delete multiple blobs without waiting for each operation to complete.
You can use
az storage remove
command with--recursive
option is a recommended method by Microsoft for deleting all blobs in a container. This approach is generally more efficient for bulk deletions because it processes the removal more effectively than deleting each blob individually.Command:
Output:
Reference: