1
votes

$f=New-TemporaryFile

$f = Get-AzureStorageBlobContent -Context $ctx -Container "name" -Blob "blobname" -Force I have tried it using the above cmndlets

1

1 Answers

1
votes

I would save the file using Get-AzureStorageBlobContent to the $env:temp directory and then use Get-Content to read it to a variable.

There's an open feature request regarding this at https://github.com/Azure/azure-powershell/issues/3665

You might be able to succeed with mikepowell's solution provided in the GitHub issue:

$storageContext = New-AzureStorageContext -ConnectionString $azConnectionString
$blob = Get-AzureStorageBlob -Context $storageContext -Container $containerName -Blob $blobName
$byteArray = New-Object Byte[] $blob.Length
$blob.ICloudBlob.DownloadToByteArray($byteArray, 0)