How to prepare the azure storage account and a storage container

The purpose of the azure storage account can be to centrally store files. It can act as bucket, act as a file share, host VHD files for VMs or lots of other use cases.

Your can create a azure storage account for example using Azure CLI or using Azure Portal.
We only cover creating it with Azure CLI here.

Login into Azure

az login

Make sure your are on the correct subscription.

az account set --subscription <subscription-id>

azure resource group

To create a general-purpose v2 storage account with Azure CLI, first create a new resource group by calling the az group create command. Choose your individual name for the resource group. In the sample I have chosen rg-storage.

az group create \
  --name rg-storage \
  --location northeurope

If you’re not sure which azure region to specify for the –location parameter, you can retrieve a list of supported regions for your subscription with the az account list-locations command.

az account list-locations \
  --query "[].{Region:name}" \
  --out table

azure storage account

Next, create a standard general-purpose v2 storage account by using the az storage account create command. Remember that the name of your storage account must be unique across Azure, so you must choose your own value value. In the sample I have chosen ststoragevhd.

az storage account create \
  --name ststoragevhd \
  --resource-group rg-storage \
  --location northeurope \
  --sku Standard_LRS \
  --kind StorageV2

azure storage container inside the storage account

Next, create a storage container inside the storage account with Azure CLI. Call the az storage container create command.

az storage container create \
    --name vhdcontainer \
    --account-name ststoragevhd

retrieve storage account access key

Next, retrieve the access key of the storage account

az storage account keys list \
  --resource-group rg-storage \
  --account-name ststoragevhd

The output is something like this. Take a note of the value of key1

    "creationTime": "2022-03-01T21:55:41.611639+00:00",
    "keyName": "key1",
    "permissions": "FULL",
    "value": "nOC8J/ZhdndUje7zeNdbGPiejnaQs+txTMUhdUmdek1uKjdqQasmcbALldkd+uSuU306Zt3JWJNKiB/6wMromw=="
    "creationTime": "2022-03-01T21:55:41.611639+00:00",
    "keyName": "key2",
    "permissions": "FULL",
    "value": "ZuemdJlaierJNasieruaoidjNw2+öakeZueWj73DjhvadfgjgASDfieuqWErlf/EhTzHuwIUbtCSPBlSN5O7A=="