This is a CLI utility to interact with Azure Blob Storage. The utility requires configuration parameters in config.yaml file. The configuration parameters include -
- url :
azure storage url - account :
storage account to communicate with azure blob storage - key :
this is the account key used to authenticate and communicate with azure blob storage
NOTE: above parameters are necessary and sufficient to perform all operations with azure blob storage.
- sasValidityDuration :
this defines the validity(in minutes) of token generated for authentication, for long operations this should be set to a higher number - maxRetries :
this is the number of retries that will be done in case an operation fails - retryInterval :
the interval between successive retries(in seconds) - skipTLSVerification :
this disables cert verification while establishing connection. To run locally disable it.
- fileList :
list of files, used as a reference for downloading reports from storage. All files added to this list can be download in one go.
A sample configuration is present in config.yaml for reference.
The CLI utility can support following operations -
- Create/delete storage container
- Upload file to blob storage
- Download single/multiple files from blob storage
- one should require node.JS and npm installed. Refer: https://nodejs.org/en/download for node installation
- additionally, to build from Makefile, you will require
makeinstalled on your environment - install node modules with
make install
- to create a build, run
make buildon shell. - the build should be available in build directory under the name
abc(azure blob cli) - [Optional] you can move
abcand config.yaml into desired folder and add it to thePATHto use it from shell.
- create container:
abc create-container -n test-containerORabc create-container --name test-container - delete container:
abc delete-container -n test-containerORabc delete-container --name test-container - download single file:
abc download -n test-container -b may_25 -f barclaysORabc download --name test-container --blob may_25 --file barclays - download all files from a blob:
abc download -n test-container -b may_25ORabc download --name test-container --blob may_25 - upload file to blob:
abc upload -n test-container -b may_25 -f reports/file.txtORabc download --name test-container --blob may_25 --file reports/file.txt - list entities in storage:
- list containers :
abc list - list blob within container :
abc list -n test-containerORabc list --name test-container - list blob with folder prefix :
abc list -n test-container -p may_25ORabc list --name test-container --prefix may_25
- list containers :
to run the utility directly replace abc in above commands with node index.js
example: node index.js create-container -n test-container and so on
- The CLI has a help options for the commands which can be invoked using
-hor--help - To run CLI in debug mode use
-dor--debugwithtrueparameter along with CLI command