Automating tasks
As usual when we reach the end of a chapter, we will work on automating the tasks that we have done manually. So, let's get started.
Creating Blob storage using PowerShell
In this topic, we will cover how to create Blob storage that everyone has read/write access to in the storage account we created in the last chapter:
$ContainerName = packtpubbs $SAK = Get-AzureRmStorageAccountKey -StorageAccountName "packtpubsaps" -ResourceGroupName packtpub $SAK = $SAK | Where {$_.KeyName -like “key1”} $SC = New-AzureStorageContext -StorageAccountName packtpubsaps -StorageAccountKey $SAK.Value New-AzureStorageContainer -Name $ContainerName -Permission Container -Context $SC Set-AzureStorageBlobContent -Container $ContainerName -File C:\test.txt -Context $SC
Steps in detail:
- Create a variable for the container name, so you do not have to write it repeatedly.
- Create a variable for the storage account key named
$SAK
, within which the access keys will be stored. - Since you need the primary...