Creating an Azure Blob Storage with azure-cli

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

Michael is a polyglot software engineer, committed to reducing complexity in systems and making them more predictable. Working with a variety of languages and tools, he shares his technical expertise to audiences all around the world at user groups and conferences. You can follow @mheap on Twitter

Thoughts on this post

Leave a comment?

Leave a Reply