Iris Classon
Iris Classon - In Love with Code

Creating and uploading to Azure blob storage with Azure PowerShell

![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Creating-and-uploading-to-Azure-blob-storage-with-Azure-PowerShell1.png) I’ve started a new video and audio series (I guess we can them podcasts?) with ‘(not so) Stupid Questions’, and while I’ve chosen to have the videos on YouTube (for now) the question was where to put the audio file? Azure of course! I’ve been wanting to dig deeper and learn more about Azure ever since I moved my site to Azure Websites from a generic host, so this is the perfect opportunity. I’m also setting up an Azure VM for some build work, so expect more on Azure as I learn new things.

The first thing I’d like to share is how to use Azure CDN, and use PowerShell to push content to a blob container. Please keep in mind that I’m learning as I’m going, so this might not be best practices or a fully featured demo.

Simply put, the steps for this is as following:

  1. Create storage
  1. Add CDN for storage
  1. Create container

Select create container

  1. Download Azure PowerShell tools
  1. Add-AzureAccount, Get-AzurePublishSettingsFile, Import-AzurePublishSettingsFile <path to dowloaded file.

Open Azure PowerShell and run the above commands, use Get-Help for help

  1. Upload blob

$myContext = New-AzureStorageContext -StorageAccountName $MyName -StorageAccountKey $MyKey

Set-AzureStorageBlobContent -Blob nameOfBlob -Container MyName -File pathToFile.jpg -Context $myContext

Thank Nik (http://www.nikgupta.net/) you for the above snippet on StackOverflow (http://stackoverflow.com/questions/18795815/get-azurestorageblob-throws-can-not-find-your-azure-storage-credential).

There are other ways to go about this, I’ll try a few more things and update the post and add some more posts as I learn new things. Hope this helps :)

 

Comments

Leave a comment below, or by email.


Last modified on 2014-05-07

comments powered by Disqus