Skip to content
Get Started for Free

Storage Accounts

An Azure storage account serves as a centralized container for all your data objects, including blobs, files, queues, and tables. It provides a unique, globally accessible namespace reachable via HTTP or HTTPS. For more information, see Overview of storage accounts.

LocalStack for Azure provides a local environment for building and testing applications that make use of blobs, queues, and tables. For more information, see:

The supported APIs are listed in the API Coverage section.

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

Start your LocalStack container using your preferred method. For more information, see Introduction to LocalStack for Azure.

[!NOTE] As an alternative to using the azlocal CLI, customers can run az start-interception. This command points the az CLI away from the public Azure cloud management API and toward the local emulator API. To revert this configuration, use azlocal stop-interception, which re-configures the CLI to send commands to the official Azure platform management REST API. At this time, there is no full parity between azlocal commands and az commands after running az start-interception. Therefore, this technique is not fully interchangeable.

Create a resource group for your storage account resources:

Terminal window
azlocal group create \
--name rg-storage-demo \
--location westeurope
Output
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-storage-demo",
"location": "westeurope",
"managedBy": null,
"name": "rg-storage-demo",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}

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

Terminal window
azlocal 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",
...
"kind": "StorageV2",
"location": "westeurope",
"name": "stordoc86acct",
...
"primaryEndpoints": {
"blob": "https://stordoc86acctblob.localhost.localstack.cloud:4566",
"queue": "https://stordoc86acctqueue.localhost.localstack.cloud:4566",
"table": "https://stordoc86accttable.localhost.localstack.cloud:4566",
...
},
"provisioningState": "Succeeded",
...
}

There are three ways to authenticate storage blob commands against the emulator:

Retrieve the account key and pass it with --account-name and --account-key:

Terminal window
ACCOUNT_KEY=$(azlocal storage account keys list \
--account-name stordoc86acct \
--resource-group rg-storage-demo \
--query "[0].value" \
--output tsv)
azlocal storage container list \
--account-name stordoc86acct \
--account-key "$ACCOUNT_KEY"

Use --auth-mode login to authenticate with the current session credentials:

Terminal window
azlocal storage container list \
--account-name stordoc86acct \
--auth-mode login

Bundle the account name and key into a single value:

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

The remaining examples in this guide use connection strings for brevity.

List the storage account access keys:

Terminal window
azlocal 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
azlocal storage account keys renew \
--account-name stordoc86acct \
--resource-group rg-storage-demo \
--key key1

Fetch a connection string for data-plane operations:

Terminal window
azlocal 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"
}
  • Control plane REST API: Storage account CRUD (create, read, update, delete, list), account key management, and name availability checks via Azure Resource Manager.
  • Multiple authentication modes: Storage account key, login credentials, and connection strings.
  • Storage account management: Create, update, delete, and list storage accounts. Supports StorageV2, BlobStorage, and Storage account kinds with configurable SKU, access tier, and TLS version.
  • Account key management: List and regenerate storage account keys (key1/key2).
  • Connection string generation: Retrieve ready-to-use connection strings containing all service endpoints (Blob, Queue, Table, File).
  • Header validation: Unsupported request headers or parameters are silently accepted instead of being rejected.
  • API version enforcement: The emulator does not validate the x-ms-version header; all API versions are accepted.

The following sample demonstrates how to use Storage Accounts with LocalStack for Azure:

OperationImplemented
Page 1 of 0
Was this page helpful?