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
2. Add CDN for storage
3. Create container
Select create container
4. Add-AzureAccount, Get-AzurePublishSettingsFile, Import-AzurePublishSettingsFile <path to dowloaded file.
Open Azure PowerShell and run the above commands, use Get-Help for help
5. 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 🙂