Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working with Azure Development Storage from command-line

I need to upload some files to my Azure storage emulator using scripts. The same task for remote Azure storage is performed easily with Azure PowerShell cmdlets, just call

Add-Blob -BlobType Block -FilePath $myFilePath -ContainerName $myContainerName

But how can I do the same thing for local storage emulator?

like image 461
corvus Avatar asked Feb 21 '23 17:02

corvus


2 Answers

For those looking for how to do this with Azure SDK (2.1), here is how:

$StorageContext = New-AzureStorageContext -Local
Set-AzureStorageBlobContent -File $SourceFilePath `
    -Container $DestinationContainerName -Blob `
    $DestinationBlobName -Context $StorageContext

If you want to actually upload to an Azure storage account, change the $StorageContext:

New-AzureStorageContext –StorageAccountName $StorageAccountName `
    -StorageAccountKey $StorageAccountKey
like image 193
Simon Ejsing Avatar answered Feb 28 '23 16:02

Simon Ejsing


You could use the Azure Command Line Tools, available here:

https://github.com/RobBlackwell/AzureCommandLineTools

They run on the normal command prompt, they're not actually powershell cmdlets.

SET AZURE_CONNECTION_STRING=UseDevelopmentStorage=true
PutBlob filename [containername[/blobname]]
like image 23
Richard Astbury Avatar answered Feb 28 '23 16:02

Richard Astbury