如何下载 Azure 存储私有容器中的文件夹

时间:2021-02-22 18:52:59

标签: azure azure-storage azure-storage-blobs azcopy

我可以下载存储中文件夹内的所有文件,如果容器设置为匿名访问,使用azcopy和以下命令:

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

但是当我将容器设置回私有访问时,它说:

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.

我知道如何为唯一的特定文件生成 SAS,但在这种情况下,我正在下载一个文件夹,如何继续?

1 个答案:

答案 0 :(得分:1)

请使用此命令:

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

您可以在那里生成 SAS 令牌:

enter image description here