【问题标题】:How to download Azure blobs in Angular with a key or with a connection string如何使用密钥或连接字符串在 Angular 中下载 Azure blob
【发布时间】:2020-04-28 15:40:57
【问题描述】:

您好,我想知道是否可以使用连接字符串或密钥下载 Azure 文件,并在 Angular 中执行该过程

当我尝试在 Angular 中使用 https://www.npmjs.com/package/@azure/storage-blob 库时,它无法识别来自ConextionString 的连接类型

知道如何实现这一点吗?

【问题讨论】:

    标签: angular typescript azure azure-blob-storage


    【解决方案1】:

    我想知道是否可以使用 连接字符串或键,并在 Angular 中执行该过程

    考虑到 Angular 代码在浏览器(即客户端)中执行,不允许使用 帐户连接字符串 (DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net) 连接到存储帐户,因为它会将您的帐户密钥暴露给客户。

    您需要做的是使用共享访问签名 (SAS) 连接字符串 (BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString)。

    更多信息可以在这里找到:https://docs.microsoft.com/en-us/javascript/api/@azure/storage-blob/blobserviceclient?view=azure-node-latest#fromconnectionstring-string--storagepipelineoptions-。

    【讨论】:

      猜你喜欢
      • 2021-11-13
      • 2019-07-08
      • 2021-07-18
      • 1970-01-01
      • 2012-10-13
      • 1970-01-01
      • 1970-01-01
      • 2021-11-30
      • 2010-11-22
      相关资源
      最近更新 更多