Get-AzureStorageBlob throws Can not find your azure storage credential Get-AzureStorageBlob throws Can not find your azure storage credential powershell powershell

Get-AzureStorageBlob throws Can not find your azure storage credential


Right so I finally managed to do this! Here is the overall details on how to use PowerShell to create a blob in Azure and store a file there.

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


You may need to set the 'current' subscription to use. For that, you must run Select-AzureSubscription.

If you run Get-AzureSubscription, you'll see all subscriptions in your publish settings. One of those subscriptions should be set as the default. As you scroll through the result list, you'll see one property, IsDefault for each subscription, set to True or False. If the subscription you're using is set to False, run:

Select-AzureSubscription -SubscriptionName mysub

Hopefully that fixes the issue you're running into.


Just a quick FYI: you can do this another (and faster way). I build a web language atop Windows PowerShell that heavily integrates with Azure. It's called PowerShell Pipeworks.

You can use 4 cmdlets to interact with the blobs:

  • Get-Blob
  • Import-Blob
  • Export-Blob
  • Remove-Blob

All take a -StorageAccount and a -StorageKey, and also a -StorageAccountSetting and a -StorageKeySetting. You can save creds to disk (or for use in a web app by using Add-SecureSetting). Once any blob cmdlet has a storage account, it will continue to reuse it.

Export-Blob is also handy in that you can pipe in a directory to it, and it will create the right content types, and provide -Public, which will mark the container it's stored in as public.

These cmdlets are a notch older (~3 months) than the Azure ones, and still about 3/4ths the time to execute (I believe a major chunk of this is their slower lookup on credentials), and are worth a try.