Creating and uploading to Azure blob storage with Azure PowerShell
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:
- Create storage
- Add CDN for storage
- Create container
Select create container
- Add-AzureAccount, Get-AzurePublishSettingsFile, Import-AzurePublishSettingsFile <path to dowloaded file.
Open Azure PowerShell and run the above commands, use Get-Help for help
- 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
Last modified on 2014-05-07