Skip to content

Latest commit

 

History

History
226 lines (180 loc) · 4.65 KB

File metadata and controls

226 lines (180 loc) · 4.65 KB
title Table Storage
description Get started with Azure Table Storage in LocalStack
template doc

import AzureFeatureCoverage from "../../../../components/feature-coverage/AzureFeatureCoverage";

Introduction

Azure Table Storage is a NoSQL key-value store for large volumes of semi-structured data. With the legacy Table API, data is organized into tables, partitions, and entities addressed by PartitionKey and RowKey. It is useful for lightweight metadata, lookup records, and simple operational datasets.

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

Getting started

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

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

azlocal start_interception

The following example creates a storage account, creates a table, and performs basic entity operations.

Create a resource group

Create a resource group for the storage resources:

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

Create a storage account

Create a storage account that will host the table service:

az storage account create \
  --name stordoc88acct \
  --resource-group rg-table-legacy-demo \
  --location westeurope \
  --sku Standard_LRS \
  --kind StorageV2
{
  "name": "stordoc88acct",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-table-legacy-demo/providers/Microsoft.Storage/storageAccounts/stordoc88acct",
  "location": "westeurope",
  "kind": "StorageV2",
  "provisioningState": "Succeeded",
  "primaryEndpoints": {
    "table": "https://stordoc88accttable.localhost.localstack.cloud:4566",
    ...
  },
  ...
}

Create and inspect a table

Get the storage account connection string used for data-plane operations:

CONNECTION_STRING=$(az storage account show-connection-string \
  --name stordoc88acct \
  --resource-group rg-table-legacy-demo \
  --query connectionString -o tsv)

Create a table:

az storage table create --name legacytable --connection-string "$CONNECTION_STRING"
{
  "created": true
}

Check whether the table exists:

az storage table exists --name legacytable --connection-string "$CONNECTION_STRING"
{
  "exists": true
}

Insert and query entities

Insert an entity into the table:

az storage entity insert \
  --connection-string "$CONNECTION_STRING" \
  --table-name legacytable \
  --entity PartitionKey=demo RowKey=1 name=Alice score=100
{
  "content": {
    "PartitionKey": "demo",
    "RowKey": "1",
    "name": "Alice",
    "score": 100,
    ...
  },
  "etag": "W/\"datetime'2026-02-27T11%3A37%3A25.7298901Z'\"",
  ...
}

Get the inserted entity:

az storage entity show \
  --connection-string "$CONNECTION_STRING" \
  --table-name legacytable \
  --partition-key demo \
  --row-key 1
{
  "PartitionKey": "demo",
  "RowKey": "1",
  "name": "Alice",
  "score": 100,
  ...
}

Query entities by partition key:

az storage entity query \
  --connection-string "$CONNECTION_STRING" \
  --table-name legacytable \
  --filter "PartitionKey eq 'demo'"
{
  "items": [
    {
      "PartitionKey": "demo",
      "RowKey": "1",
      "name": "Alice",
      "score": 100,
      ...
    }
  ],
  "nextMarker": {}
}

Update, delete, and verify

Update the entity with a merge operation:

az storage entity merge \
  --connection-string "$CONNECTION_STRING" \
  --table-name legacytable \
  --entity PartitionKey=demo RowKey=1 score=101
{
  "etag": "W/\"datetime'2026-02-27T11%3A37%3A27.3795415Z'\"",
  ...
}

Delete the entity and verify the table is empty:

az storage entity delete \
  --connection-string "$CONNECTION_STRING" \
  --table-name legacytable \
  --partition-key demo \
  --row-key 1

az storage entity query \
  --connection-string "$CONNECTION_STRING" \
  --table-name legacytable
{
  "deleted": null
}
{
  "items": [],
  "nextMarker": {}
}

API Coverage