Bartosz
Bartosz

Reputation: 4602

Get blob storage content in powershell

I'm using Get-AzureStorageBlobContent command to get the blob which holds version of my app:

$latestDeployment = (Get-AzureStorageBlobContent -Blob app.version -Container container -Context $blobContext)

This command saves it as a file to the disk, while I would like to load it to memory and just read the content without saving anything. Is it possible using powershell?

Upvotes: 4

Views: 9124

Answers (3)

$latestDeployment = Get-Content (Get-AzureStorageBlob -Blob app.version -Container container -Context $blobContext)

Upvotes: -1

x5657
x5657

Reputation: 1212

This should work

$latestDeploymentBlob = Get-AzureStorageBlob -Blob app.version -Container $container -Context $blobContext 
$latestDeployment = $latestDeploymentBlob.ICloudBlob.DownloadText()

Upvotes: 11

Shui shengbao
Shui shengbao

Reputation: 19223

Based on my knowledge, it is not possible for you to do it by using Power Shell. With Power Shell, you could list, download, copy blobs, but you could not directly read blobs in storage account. If you want to read blobs, you need download them locally and read them. More information about how to manage blobs with Power Shell please refer to this link.

However, it is easy for you to use codes to read blobs in storage account. Please refer to this example.

Upvotes: 1

Related Questions