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
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Azure-CDN-With-PowerShell.png)
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Azure-CDN-With-PowerShell2.png)
- Add CDN for storage
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Azure-CDN-With-PowerShell3.png)
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Azure-CDN-With-PowerShell4.png)
- Create container
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Azure-CDN-With-PowerShell5.png)
Select create container
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Azure-CDN-With-PowerShell7.png)
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Azure-CDN-With-PowerShell8.png)
- Add-AzureAccount, Get-AzurePublishSettingsFile, Import-AzurePublishSettingsFile <path to dowloaded file.
Open Azure PowerShell and run the above commands, use Get-Help for help
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Azure-CDN-With-PowerShell9.png)
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Azure-CDN-With-PowerShell10.png)
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Azure-CDN-With-PowerShell11.png)
- Upload blob
![](https://inlovewithcode.azureedge.net/wp-content/uploads/2014/05/Creating-and-uploading-to-Azure-blob-storage-with-Azure-PowerShell1.png)
$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