How to dowload multiple blobs from Azure to Linux VM?

Vinoth Kaliaperumal 386 Reputation points
2023-09-13T11:53:42.89+00:00

Hi All,

I need to download multiple blobs from Azure to my linux vm. Looking out for any way to do this. Please assist.

Thanks.

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,158 questions
0 comments No comments
{count} votes

Accepted answer
  1. Deepanshukatara-6769 9,195 Reputation points
    2023-09-13T12:06:57.7966667+00:00

    Hi , Hope doing good!

    To answer your query , please check below Using AzCopy:

    AzCopy is a command-line utility specifically designed for transferring data to and from Azure Blob Storage.

    a. Download and install AzCopy on your Linux VM by following the instructions here: https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10

    b. Once installed, open a terminal.

    c. Use the azcopy copy command to download multiple blobs. Here's an example command:

    
    azcopy copy "https://mystorageaccount.blob.core.windows.net/mycontainer/*" /path/to/local/folder --recursive=true
    

    Replace https://mystorageaccount.blob.core.windows.net/mycontainer/* with the URL of your container and blobs (you can use wildcards), and /path/to/local/folder with the local directory where you want to save the downloaded blobs.

    Also , please use above link for more info

    And please accept answer if it has helped , Thanks


1 additional answer

Sort by: Most helpful
  1. dashanan13 930 Reputation points
    2023-09-17T21:23:21.24+00:00

    Hei vinothkaliaperumal-2643,

    Thank you for contacting Microsoft community.

    It is possible to install powershell on linux and use the code below to download the blobs while enumerating each container in each storage account.

    Read more:

    Quickstart: Upload, download, and list blobs with PowerShell Install PowerShell on Linux

    Please mark this as "answer" if it helped

    acceptasAnswer

    $myrgs = Get-AzResourceGroup
    foreach ($myrg in $myrgs){
        $myrsrs = Get-AzStorageAccount -ResourceGroupName $myrg.ResourceGroupName
        foreach ($myrsr in $myrsrs){
            $ctx = New-AzStorageContext -StorageAccountName $myrsr.StorageAccountName
            $containers = Get-AzStorageContainer -Context $ctx 
            foreach ($container in $containers){
                Get-AzStorageBlob -Container $container.Name -Context $ctx | Get-AzStorageBlobContent -Destination "C:\temp\dwnld"
            }
        }
    }
    
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.