Search code examples
azureazure-storageazure-blob-storageazcopy

How to download a folder in a private container of Azure Storage


I can download all files inside a folder in my storage, if the container is set as annonymous access, using azcopy and the following command:

AzCopy cp https://.blob.core.windows.net/files/modules/ C:\Users\AppData\Roaming\modules --recursive --log-level NONE & azcopy jobs clean

But when I set the container back to private access, it says:

failed to perform copy command due to error: Login Credentials missing. No SAS token or OAuth token is present and the resource is not public
INFO: Removed 0 files.

I know how to generate the SAS for a unique specific file but in this case that I'm downloading a folder, how to proceed?


Solution

  • Please use this command:

    AzCopy cp 'https://<your-storage-name>.blob.core.windows.net/container/<folder>?<your-sas-token>' 'C:\Users\AppData\Roaming\modules' --recursive
    

    You can generate SAS token there:

    enter image description here