Use Azure Development Repository from the command line

I need to upload some files to my Azure storage emulator using scripts. The same task for Azure Remote Storage is easy to accomplish with Azure PowerShell cmdlets, just call

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

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

+4
source share
3 answers

Found a solution using PowerShell cmdlets.

You need to specify the -UseDevelopmentStorage parameter for cmdlets:

 Get-Container -UseDevelopmentStorage 

or

 Add-Blob -UseDevelopmentStorage -BlobType Block -FilePath $myFilePath -ContainerName $myContainerName 
+2
source

For those who are looking for how to do this with the Azure SDK (2.1), here's how:

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

If you want to upload to your Azure account, change the value of $ StorageContext:

 New-AzureStorageContext –StorageAccountName $StorageAccountName ` -StorageAccountKey $StorageAccountKey 
+3
source

You can use the Azure command line tools available here:

https://github.com/RobBlackwell/AzureCommandLineTools

They run on a regular command line; they are not powershell cmdlets.

 SET AZURE_CONNECTION_STRING=UseDevelopmentStorage=true PutBlob filename [containername[/blobname]] 
+2
source

Source: https://habr.com/ru/post/1393153/


All Articles