【问题标题】:Use the Azure Cli to access Azure storage using a SAS使用 Azure Cli 通过 SAS 访问 Azure 存储
【发布时间】:2016-12-10 21:16:52
【问题描述】:

是否可以使用 SAS(共享访问签名)从 CLI 访问 Azure 存储容器?

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

【问题讨论】:

    标签: azure azure-storage azure-blob-storage azure-cli


    【解决方案1】:

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

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

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

    【讨论】:

    • 未来的读者 - 请注意 --sas 参数仅采用 sas 参数和签名。不是整个uri。此外,sas 包含在某些情况下必须转义的字符(%&amp; 等)。确保你这样做。
    【解决方案2】:

    在最新版本的 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>"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-16
      • 1970-01-01
      • 2015-10-29
      • 2020-10-10
      • 1970-01-01
      • 1970-01-01
      • 2018-06-25
      • 1970-01-01
      相关资源
      最近更新 更多