使用 Azure Cli 通过 SAS 访问 Azure 存储

Use the Azure Cli to access Azure storage using a SAS

有没有办法使用 SAS(共享访问签名)从 CLI 访问 Azure 存储容器?

显然可以using an account name and a key,或者使用连接字符串。但我想在只能从容器读取的脚本中使用 CLI。

使用 sas(通过 --sas 命令行参数)列出 blob 的功能已经存在了一段时间。

最新的 CLI (0.10.2) 现在在 uploading/downloading blob 时也有一个 --sas 命令行选项。所以...

azure storage blob upload --sas <sas> -c <connection-string> ...
azure storage blob list --sas <sas> ...
azure storage blob download --sas <sas> ...

在最新版本的 Azure CLI 中:

az storage blob upload --connection-string "<your SAS connection string>"
az storage blob list --connection-string "<your SAS connection string>"
az storage blob download --connection-string "<your SAS connection string>"