Azure Table Service API Guide

Use Azure Table Storage with Chilkat.Rest to manage tables and entities, query data, control concurrent writes, and submit atomic transactions. This guide connects 22 examples with Shared Key, Microsoft Entra ID, and SAS authentication.

Before making requests. Use Chilkat 11.6.0 or later and unlock the library. These examples target Azure Storage accounts at https://{account}.table.core.windows.net. They are configured for Azure public-cloud Table Storage; Azure Cosmos DB for Table and sovereign-cloud endpoints need their own configuration.

The examples pin x-ms-version: 2026-04-06, documented by Microsoft as fully deployed at review time, and send OData 3.0 version headers. Older supported versions are not automatically obsolete. SAS also carries its signed version in sv; when consuming a supplied token, retain its signed parameters. See Storage versioning and OData version headers.

Choose the authentication path
MethodPrivate inputsHow the examples use it
Shared Keyaccount, access_keyMost examples use AuthAzureStorage with Service="Table" and Scheme="SharedKey".
Entra client credentialsaccount, tenant_id, client_id, client_secretAcquire a Storage token and read an entity.
Azure VM managed identityaccount; optional managed_client_idAcquire a token from the VM's fixed IMDS endpoint.
Table service SASaccount and a supplied SAS tokenRead without an account key; permissions and key ranges come from the token.

Configuration comes from private qa_data/azure/storage.json. The access key is the base64 account key, not a connection string. Create private qa_data/azure and qa_output directories before running file-writing examples. Keep keys, tokens, SAS, entity values, checkpoints and diagnostic dumps outside public web content and source control.

The endpoint, table name, and entity keys are separate inputs. Table names are case-insensitive; PartitionKey and RowKey are case-sensitive strings that together identify an entity. Most samples use table ExampleCustomers, partition customers-west, and row customer-001. The encoding demonstration instead reads row O'Brien + 01; prepare that entity separately. See the Table data model.

Create Tables and Insert Typed Entities

Create Table sends POST /Tables with a TableName and Prefer: return-content. It requires HTTP 201 and verifies the returned name. Insert Entity sends a new entity to an existing table with Prefer: return-no-content, requires HTTP 204, and retains its ETag. Neither example silently treats an existing resource as success.

Entity JSON needs explicit Edm.Guid, Edm.DateTime, and Edm.Int64 annotations for those properties. The insert example keeps Int64 digits in a string, including a value beyond JavaScript's exact integer range. Timestamp is server-managed. Its AmountDue field demonstrates a double, not exact decimal currency; an integer minor-unit design is more suitable when exact money values are required. See Table JSON types.

Microsoft Entra ID and Managed Identity

Microsoft recommends Entra authorization where available. Assign a suitable Table data role, such as Storage Table Data Reader for these reads. A management-plane Contributor role alone does not grant Table data access. The client-credentials example requests https://storage.azure.com/.default; the VM example requests resource https://storage.azure.com/. See Table authorization with Entra ID.

Both examples save access_token, expires_at, and resource to private table-token.json and immediately use the token for an entity GET. Expiry is calculated from request-start time. Client credentials do not issue a refresh token; reacquire before expiry. The other Shared Key examples do not automatically consume this cache.

VM managed identity uses the fixed link-local IMDS endpoint with its Metadata header and no proxy. Omit managed_client_id for the VM's system-assigned identity. App Service and Azure Arc have different identity flows.

Table Shared Access Signatures

The generator creates an account-key Table service SAS for read access over HTTPS. It restricts access to partition customers-west and the inclusive lexical row range customer-001 through customer-099, expiring about 15 minutes after creation. It includes Table-specific key bounds and a lowercase canonical table name. Respect any stricter account SAS-expiration policy.

The consumer reads private table-sas.txt, containing a percent-encoded query string without a leading question mark. Rest.AddQueryParams handles that encoded string; do not decode and reassemble the signature manually. It sends no account key or Authorization header. The application fixes the destination account and entity path.

This SAS grants entity reads within its bounds, not table administration. Anyone holding it can use those permissions until expiry. It is a Table service SAS, not a Blob user-delegation SAS. See service SAS construction.

Point Reads, Queries, and Pagination

A point read addresses both keys. Escape apostrophes for OData first, then percent-encode each key once; preserve the surrounding entity-path syntax. The example checks that the returned keys match and keeps the exact ETag. Entity values remain in the parsed JSON rather than being logged.

Table enumeration follows x-ms-continuation-NextTableName. Entity queries follow x-ms-continuation-NextPartitionKey and the optional NextRowKey header. These are opaque tokens, not names to reconstruct. An empty page can still have continuation tokens, and $top limits each page rather than the total scan.

The query example preserves $filter, $select, and $top on every request. Both listing examples detect repeated tokens and bound the page count. Process the current result.value before requesting the next page. Enumeration is not a point-in-time snapshot. See Table pagination.

Resumable Query Processing

The resume example fetches one page per run. It writes private qa_output/table-page.json, then advances qa_data/azure/table-checkpoint.json. The checkpoint is bound to the account, collection path, filter, projection, page size, and API version. Mismatched or malformed checkpoints stop instead of silently restarting.

Process and archive the page before the next run: the example refuses to overwrite an unprocessed output. Use one caller and keep the checkpoint until completion. A crash between the two writes can replay a page, so deduplicate downstream by entity identity/version. These files do not form an atomic transaction; use transactional durable state for stronger processing guarantees.

Updates, Upserts, and Concurrency

Choose write semantics deliberately
OperationOmitted propertiesConcurrency in the example
Conditional MERGEPreservedGET, then exact ETag in If-Match
Conditional PUT replacementRemovedGET, then exact ETag in If-Match
Insert-or-mergePreserved on an existing entityUnconditional upsert; no If-Match
Insert-or-replaceRemoved on an existing entityUnconditional upsert; no If-Match
Conditional DELETEThe selected entity is removedGET, then exact ETag in If-Match

These five mutation examples start with applyChange=false. Review the target and payload before enabling it. Preserve ETags exactly, including the weak prefix and quotes. HTTP 412 means another writer changed the entity: reread and reconcile rather than switching to a wildcard. A successful write expects HTTP 204.

MERGE does not delete a property by setting it to null. Replacement intentionally keeps only the supplied custom properties; the sample retains Address and IsActive alongside the keys. Upsert can create missing entities and overwrite existing data without an ETag check. See MERGE and replacement semantics.

Atomic Entity Group Transactions

Each example submits two distinct entities in one table and partition. The insert batch needs absent rows; the mixed batch reads existing rows and captures their ETags before merging one and deleting the other. Both require deliberate enablement.

A dynamic batch must contain no more than 100 operations, use each entity only once, and stay within 4 MiB including multipart overhead. The samples satisfy the identity constraints by construction and check the final byte size. They use CRLF framing and unique Content-IDs.

Outer HTTP 202 acknowledges the envelope, not transaction success. Chilkat.Mime parses the nested response; the examples require matching, unique Content-IDs and HTTP 204 for both operations. A service-reported operation failure rolls back its changeset. A lost or malformed response requires reconciliation before replay. Atomicity does not extend across separate batches. See entity group transactions.

Policies, Service Properties, and Table Deletion

Table ACLs contain XML stored access policies used by service SAS. They are separate from Azure RBAC assignments and do not enable anonymous Table access. The update example reads the collection, inserts or updates example-read, and preserves unrelated entries. It refuses duplicate IDs and a sixth policy. This read-modify-write sequence has no ETag protection here; coordinate administrators. Allow policy propagation before judging a SAS response. See stored access policies.

The service-properties example is read-only until updateCors=true. Its PUT sends only a complete Cors element, replacing the CORS rule collection while preserving omitted logging and metrics settings. Adapt the demonstration origin first. CORS controls browser access to responses; it does not grant authorization. See service properties.

Delete Table removes the table and all its entities. The separate, default-off example expects HTTP 204. Internal deletion can continue afterward, temporarily blocking name reuse. Do not treat a conflict or missing resource as proof of successful deletion.

Bounded Read Retries

The GET retry example allows at most five attempts for selected transient HTTP statuses, with exponential backoff and jitter. It honors numeric and HTTP-date Retry-After, stops if the service asks for more than 30 seconds, and rejects invalid delay values. Connection and read timeouts also bound each attempt.

Authentication failures and transport failures stop. The example retries only its read, not creates, upserts, batches, policy changes, or deletes. A lost write response can leave the outcome uncertain; inspect state before deciding to repeat it. See Table scalability guidance.

Troubleshooting

Checks for common failures
SymptomWhat to check
400 or unexpected property typesOData headers, valid table/key names, typed JSON annotations, and URI encoding. Int64 values stay strings.
401 or 403Token audience/expiry, Table data roles, account policy and network restrictions. For SAS, also check expiry, permissions, signed key bounds and preserved signature encoding.
404Account, table, and exact case-sensitive entity keys. The encoding sample uses a different row from the other reads.
409Create/insert conflicts or a table still deleting. Inspect existing state; do not convert the request into an upsert automatically.
412A stale ETag. Reread and decide how to reconcile the concurrent change.
Incomplete listingContinuation headers even on empty pages; retain the original filter, projection and page size.
Resume output already existsProcess/archive the saved page before continuing. Preserve evidence after a checkpoint-save failure so replay can be deduplicated.
Batch returns 202Inspect every inner result and Content-ID. The outer status does not prove the changeset succeeded.
Unexpected response or timeoutCheck transport and exact HTTP status before parsing. Keep request IDs for diagnosis without logging credentials, SAS, entity payloads or full diagnostics.

For operation details, see the Microsoft Table REST reference and the Chilkat.Rest reference.