Creating an Azure Blob Storage with azure-cli

19 Jan 2017 in TIL

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:

bash
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

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

Now you can create a container and interact with it

bash
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