Search code examples
pythonlinuxazureblobazcopy

How to copy the files from Azure blob to some of the path in Linux


I am trying to copy the files available in Azure blob to Linux server landing path. I am trying to use azcopy command, but I am unable to copy the files. Please, anyone can you help me, we are fighting for this issue from last 3 days.

Please help us.

i am trying to run the below command in Linux server and i referred microsoft web pages as well but no luck

azcopy --source XXXXXXX.blob.core.windows.net/Container?sssssssxxxsddsxx==== --destination /JsonFiles/

--destination: command not found...


Solution

  • You can use the latest version of Azcopy and the version is v10. See the details in Latest production version. Then the steps below:

    wget -O azcopy.tar.gz https://aka.ms/downloadazcopylinux64
    tar -xf azcopy.tar.gz
    

    Then there is an executable file azcopy. You can get the help by running ./azcopy. And you can use the command here to download the blob file:

    ./azcopy copy "https://[account].blob.core.windows.net/[container]/[path/to/blob]?[SAS]" "/path/to/file.txt"
    

    Update

    In version 7.2, the command should be like this:

    sudo azcopy --source https://[account].blob.core.windows.net/[container]/[path/to/blob] --destination /path/to/file --source-sas "?source-sas-with-read-permission"
    

    The command needs the root permission and the value of the parameter --source-sas is "?sas-token". Take care that there is a question mark before the SAS key inside the quotation mark.

    Without Sudo it also worked, just need to add quotes. Below is the command

    azcopy --source "https://XXXXXX.blob.core.windows.net/Container?xxxxxxxxxxxxxx" --destination /landing/