Azure Table Storage Quickstart

Overview

Azure Table Storage provides a NoSQL key‑value store for rapid development of highly scalable applications. This quickstart shows how to create a table, insert an entity, and query data using the Azure SDK for JavaScript (Node.js).

Prerequisites

Step‑by‑step Code

Sample Script (copy to a file quickstart.js)

const { TableClient, AzureNamedKeyCredential } = require("@azure/data-tables");

// Replace with your values
const account = "";
const accountKey = "";
const tableName = "QuickstartTable";

async function main() {
  const credential = new AzureNamedKeyCredential(account, accountKey);
  const client = new TableClient(
    `https://${account}.table.core.windows.net`,
    tableName,
    credential
  );

  // Create table if it doesn't exist
  await client.createTable();

  // Insert an entity
  const entity = {
    partitionKey: "SamplePartition",
    rowKey: "001",
    Name: "John Doe",
    Age: 30,
    Email: "john.doe@example.com",
  };
  await client.upsertEntity(entity);

  // Query the entity
  const queried = await client.getEntity("SamplePartition", "001");
  console.log("Fetched entity:", queried);
}

main().catch((e) => console.error(e));