Skip to content
Get Started for Free

Storage Accounts

Azure Storage Accounts provide a unified namespace for Azure Storage services such as Blob, Queue, File, and Table. They are the foundational resource used to store and organize application data at scale. Most Azure storage workflows begin by provisioning and configuring a storage account.

LocalStack for Azure lets you build and test storage account workflows locally using the same CLI-based flow as cloud environments. The supported APIs are listed in the API Coverage section.

This guide is designed for users new to Azure Storage Accounts and assumes basic knowledge of the Azure CLI and azlocal.

Start by enabling interception so your az commands are routed to LocalStack:

Terminal window
azlocal start_interception

The following example creates a storage account, inspects account details, manages access keys, and creates a blob container.

Create a resource group for your storage account resources:

Terminal window
az group create --name rg-storage-demo --location westeurope
Output
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-storage-demo",
"location": "westeurope",
"name": "rg-storage-demo",
"properties": {
"provisioningState": "Succeeded"
},
"..."
}

Create a storage account with the StorageV2 kind and Standard_LRS SKU:

Terminal window
az storage account create \
--name stordoc86acct \
--resource-group rg-storage-demo \
--location westeurope \
--sku Standard_LRS \
--kind StorageV2
Output
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-storage-demo/providers/Microsoft.Storage/storageAccounts/stordoc86acct",
"name": "stordoc86acct",
"location": "westeurope",
"kind": "StorageV2",
"provisioningState": "Succeeded",
"primaryEndpoints": {
"blob": "https://stordoc86acctblob.localhost.localstack.cloud:4566",
"queue": "https://stordoc86acctqueue.localhost.localstack.cloud:4566",
"table": "https://stordoc86accttable.localhost.localstack.cloud:4566",
"..."
},
"..."
}

List storage accounts in the resource group:

Terminal window
az storage account list --resource-group rg-storage-demo
Output
[
{
"name": "stordoc86acct",
"location": "westeurope",
"kind": "StorageV2",
"type": "Microsoft.Storage/storageAccounts",
"..."
}
]

List the storage account access keys:

Terminal window
az storage account keys list \
--account-name stordoc86acct \
--resource-group rg-storage-demo
Output
[
{
"keyName": "key1",
"permissions": "FULL",
"value": "MWFjYTgyZjgtYzU0My00NjE0LThmZDctNzlkODg5ZjU4ZTE5",
"..."
},
{
"keyName": "key2",
"permissions": "FULL",
"value": "NzliNzVhN2EtYTcwZC00ZTg4LWJkMTQtYjg4MWNlMDJjZDcx",
"..."
}
]

Regenerate the primary key:

Terminal window
az storage account keys renew \
--account-name stordoc86acct \
--resource-group rg-storage-demo \
--key key1

Fetch a connection string for data-plane operations:

Terminal window
az storage account show-connection-string \
--name stordoc86acct \
--resource-group rg-storage-demo
Output
{
"connectionString": "DefaultEndpointsProtocol=https;EndpointSuffix=localhost.localstack.cloud:4566;AccountName=stordoc86acct;AccountKey=...;BlobEndpoint=https://stordoc86acctblob.localhost.localstack.cloud:4566;FileEndpoint=https://stordoc86acctfile.localhost.localstack.cloud:4566;QueueEndpoint=https://stordoc86acctqueue.localhost.localstack.cloud:4566;TableEndpoint=https://stordoc86accttable.localhost.localstack.cloud:4566"
}

Store the account connection string in an environment variable:

Terminal window
CONNECTION_STRING=$(az storage account show-connection-string \
--name stordoc86acct \
--resource-group rg-storage-demo \
--query connectionString -o tsv)

Create a blob container in the storage account:

Terminal window
az storage container create \
--name docs-container \
--connection-string "$CONNECTION_STRING"
Output
{
"created": true
}

List containers in the storage account:

Terminal window
az storage container list --connection-string "$CONNECTION_STRING"
Output
[
{
"name": "docs-container",
"properties": {
"hasImmutabilityPolicy": false,
"hasLegalHold": false,
"..."
},
"..."
}
]
OperationImplemented
Page 1 of 0
Was this page helpful?