html - Angular,Azure.CreateBlobService 未读取传入的环境变量或值?

标签 html angular azure typescript azure-blob-storage

我正在使用 Azure Blob 服务库中的此函数:https://azure.github.io/azure-storage-node/global.html#createBlobService

但它不允许我这样做,当在environment.ts中指定环境变量时,它会抛出此错误:错误错误:创建服务客户端时必须提供凭据。

当尝试传入 ConnectionString 时,它会抛出此错误:ERROR TypeError: crypto.createHmac is not a function

  var azure = require('azure-storage');
  var bs = azure.createBlobService();
  bs.createContainerIfNotExists('taskcontainer', {
    publicAccessLevel: 'blob'
  }, function(error, result, response) {
    if (!error) {
      console.log("True");
      // if result = true, container was created.
      // if result = false, container already existed.
    }
  });

以前有人遇到过这个问题吗?很高兴看到解决方案

最佳答案

您应该提供帐户名和存储 key ,如下所示:

var blobService = azure.createBlobService(environment.storage_account_name, environment.storage_key);

关于html - Angular,Azure.CreateBlobService 未读取传入的环境变量或值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49790718/

相关文章:

Azure 事件网格 - Webhook 订阅身份验证和 DDOS 保护

html - 在容器内水平对齐 3divs

javascript - Angular [ngClass] 条件和函数组合

c# - 可以添加到 Azure 队列的 Base64 编码字符串的最大长度是多少?

Azure 导入/导出工具 dataset.csv 和多个 session 文件夹

javascript - Angular 是否需要 TypeScript?

javascript - 设置元素属性时未触发 Polymer "property-changed"事件

html - 如何将标题添加到表格底部?

html - 如何删除移动 View 中的水平滚动条?

android - 我试图在 ionic 中添加 android 平台但它不起作用,它显示错误