Skip to content

Latest commit

 

History

History
134 lines (102 loc) · 3.09 KB

File metadata and controls

134 lines (102 loc) · 3.09 KB
title Tables
description Get started with Azure Tables in LocalStack
template doc

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

Introduction

Azure Tables is a schema-less NoSQL store for semi-structured data, optimized for fast lookups with partition and row keys. It is commonly used for metadata, state tracking, and lightweight application records. With the modern API, you can manage tables and query entities through the Azure Tables data plane.

LocalStack for Azure lets you build and test Azure Tables workflows locally using familiar CLI patterns. The supported APIs are listed in the API Coverage section.

Getting started

This guide is designed for users new to Azure Tables 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 storage resources, creates a table, and queries entities using the modern API flow.

Create a resource group

Create a resource group for your Tables resources:

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

Create a storage account for Tables

Create a storage account that provides the Tables endpoint:

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

Create and list tables

Get a connection string for data-plane table operations:

CONNECTION_STRING=$(az storage account show-connection-string \
  --name tablesdoc87acct \
  --resource-group rg-tables-modern-demo \
  --query connectionString -o tsv)

Create a table:

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

List tables in the account:

az storage table list --connection-string "$CONNECTION_STRING"
[
  {
    "name": "moderntable"
  }
]

Query entities in the table

Query entities from the table (empty response in this fresh table):

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

API Coverage