Interact with Azure blob storage using PowerShell

Interact with blob storage using PowerShell

John Savill

July 10, 2017

1 Min Read
Interact with Azure blob storage using PowerShell

Q. How can I interact with Azure blob storage using PowerShell?

A. Azure block blobs enable pretty much anything to be stored, for example a media file, document. You can upload and download data using REST APIs, CLI, graphical tools like Azure Storage Explorer and PowerShell.

The PowerShell below is a simple demo that creates a new container and then uploads an image.

$StrContext = New-AzureStorageContext -ConnectionString ""#Blobs$StrContainer = 'images'#Create a new continaerNew-AzureStorageContainer -Context $StrContext -Name $StrContainer #Upload all items from a path to the containerGet-ChildItem –Path C:UsersjosaviOneDriveDocumentsTestPictures* | Set-AzureStorageBlobContent -Context $StrContext -Container $StrContainer#BrowseGet-AzureStorageBlob -Context $StrContext -Container $StrContainer#Download with Get-AzureStorageBlob ... | Get-AzureStorageBlobContent -Destination  -Context $StrContext#Remove the contentGet-AzureStorageBlob -Context $StrContext -Container $StrContainer | Remove-AzureStorageBlob -Context $StrContext#Remove the containerRemove-AzureStorageContainer -Context $StrContext -Name $StrContainer

 

About the Author(s)

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like