我正在使用 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/