Last active
May 23, 2017 23:36
-
-
Save mwinkle/a80006ec4c541f94b524 to your computer and use it in GitHub Desktop.
Azure XPlat CLI in order to list and download blobs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first, make sure you have downloaded the Azure XPlat CLI | |
# http://azure.microsoft.com/en-us/documentation/articles/xplat-cli/#install | |
# eg, sudo npm install azure-cli -g | |
# login to Azure (will prompt for your username/password) | |
azure login | |
# show all of your storage accounts | |
azure storage account list | |
# pick your storage account (eg, "_____foo_____") | |
# output your storage account connection string | |
azure storage account connectionstring show _____foo_____ | |
# this will output a string which you'll want to capture | |
# TODO: some shell magic to do this in oneline | |
# Example string: DefaultEndpointsProtocol=https;AccountName=____foo_____;AccountKey=[YOUR ACCOUNT KEY HERE] | |
export AZURE_STORAGE_CONNECTION_STRING=[STRING FROM ABOVE] | |
# validate connectivity and pick a container which has the file you want [CONTAINER] | |
azure storage container list | |
# list all blobs | |
azure storage blob list [CONTAINER] | |
# note, one cool thing is you can pass a prefix in (eg, the wasb path) | |
azure storage blob list [CONTAINER] /output/sample/data/f | |
# now, downloading is easy | |
azure storage blob download [CONTAINER] /path/to/your/file | |
# TODO: a little bit of magic to go from container output to a download |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PS C:\windows\system32> export AZURE_STORAGE_CONNECTION_STRING = lbi9ynz+e72RuIGq8dSiqJRf/xZH06QM6EkxI75jQAQTluRJOflfN0Ak9VXYALt7WTr3cMYI0APxvsIQY++Png==
export : The term 'export' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.