powershell - Get-AzureStorageBlob 抛出找不到您的 azure 存储凭据

标签 powershell azure azure-blob-storage

我刚刚开始使用 Azure,在使用 PowerShell cmdlet 处理我的存储帐户时遇到问题。

我已创建一个存储帐户并在该存储帐户中创建一个容器。接下来,我安装了 Azure Powershell SDK 和命令让等,并导入了publishsettings 文件。当我执行 Get-AzureSubscription 或 Get-AzureStorageAccount 命令时,它会在 PowerShell 控制台中正确显示我的订阅以及各种存储端点。

但是,如果我执行 Get-AzureStorageBlob 调用或 Set-AzureStorageBlobContent,则会收到以下错误

Get-AzureStorageBlob : Can not find your azure storage credential. Please set current storage account using
"Set-AzureSubscription" or set the "AZURE_STORAGE_CONNECTION_STRING" environment variable.

我真的是束手无策了。对此错误字符串的 Google 搜索只会显示对 Github 等上的代码的引用。非常感谢一些帮助。

最佳答案

是的,我终于成功了!以下是有关如何使用 PowerShell 在 Azure 中创建 blob 并在其中存储文件的总体详细信息。

http://www.nikgupta.net/2013/09/azure-blob-storage-powershell/

$context = New-AzureStorageContext -StorageAccountName FunkyStorage -StorageAccountKey {Enter your storage account key here}

Set-AzureStorageBlobContent -Blob "MyFunkyBlob" -Container FunkyContainer-File "c:\temp\1.txt" -Context $context -Force

关于powershell - Get-AzureStorageBlob 抛出找不到您的 azure 存储凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18795815/

相关文章:

Powershell: 'The fully qualified file name must be less than 260 characters'

powershell - 使用 csv 的 ForEach 中的 If 语句

azure - 不同平台的WEB API认证

entity-framework - Azure函数与数据库的连接字符串使用 Entity Framework 的第一种方法

azure - 如何使用 Powershell 从 Azure Functions 获取 Azure Blob URI?

azure - Azure Blob 存储容器有文件数量限制吗?

c# - pipeline.invoke 和 powershell.invoke 有什么区别?

将文件名作为参数传递时的 powershell 通配符

azure - 将 ARM 模板部署到 Azure 的最佳推荐方法是什么

Azure 数据移动库 - Blob 下载陷入困境