Create a Resource Group
New-AzResourceGroup -Name storagePractice -Location eastus
Create a Storage Account
New-AzStorageAccount -Name storageaccountpractice -ResourceGroupName storagePractice -Location eastus -SkuName Standard_LRS
Get Storage Account Key Value
$key = (Get-AzStorageAccountKey -ResourceGroupName storagepractice -Name storageaccountpractice)[0].value
Create New Storage Content
$context = New-AzStorageContext -StorageAccountName storageaccountpractice -StorageAccountKey $key
Create a Storage Blob Container
New-AzStorageContainer -Name images -Context $context -Permission Blob
Upload Image to Azure Storage Blob Container
Set-AzStorageBlobContent -File ./books.png -Container images -Blob 'books.png' -Context $context
List Contents of an Azure Blob Storage Container
Get-AzStorageBlob -Container images -Context $context
Download Contents of Azure Blob Storage Container
Get-AzStorageBlobContent -Blob "books.png" `
-Container images `
-Destination "books2.png" `
-Context $context
Remove Azure Resource Group ( Cleanup )
Remove-AzResourceGroup -Name storagePractice -Force
Sources
Quickstart: Upload, download, and list blobs by using Azure PowerShell
Top comments (0)