Get-AzureStorageBlob throws无法找到您的azure存储凭据

Nik*_*hil 9 powershell azure azure-storage-blobs

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

我在该存储帐户中创建了一个存储帐户和一个容器.接下来,我安装了Azure Powershell SDK和命令let等,并导入了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.
Run Code Online (Sandbox Code Playgroud)

我确实在这里结束了.谷歌搜索这个错误字符串只会引起对Github等代码的引用.真的很感激一些帮助.

Nik*_*hil 20

是的,所以我终于成功了!以下是有关如何使用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
Run Code Online (Sandbox Code Playgroud)