Creating an Azure Blob Storage with azure-cli

This article was published 2 years ago. Due to the rapidly evolving world of technology, some concepts may no longer be applicable.

A quick reminder to myself on how to create a blob storage instance in Azure

First, create a storage account and list the access keys:

azure storage account create -l eastus -g <resource_group> --sku-name GRS --kind blobstorage --access-tier Hot <storageaccountname>
azure storage account keys list <storageaccountname> -g <resource_group>

At this point you need to populate some environment variables to connect to your new storage account

export AZURE_STORAGE_ACCOUNT="<storageaccountname>"
export AZURE_STORAGE_ACCESS_KEY="<key_from_previous_command>"

Now you can create a container and interact with it

azure storage container create demo
azure storage blob upload foo.txt demo
azure storage blob download demo foo.txt world.txt
azure storage blob delete demo foo.txt --delete-snapshots include -q

Thoughts on this post

Leave a comment?

Leave a Reply