LinuxCommandLibrary

az-storage-entity

Manage Azure Storage table entities

TLDR

Insert an entity into a table

$ az storage entity insert [[-e|--entity]] [space_separated_key_value_pairs] [[-t|--table-name]] [table_name] --account-name [storage_account_name] --account-key [storage_account_key]
copy

Delete an existing entity from a table
$ az storage entity delete --partition-key [partition_key] --row-key [row_key] [[-t|--table-name]] [table_name] --account-name [storage_account_name] --account-key [storage_account_key]
copy

Update an existing entity by merging its properties
$ az storage entity merge [[-e|--entity]] [space_separated_key_value_pairs] [[-t|--table-name]] [table_name] --account-name [storage_account_name] --account-key [storage_account_key]
copy

List entities which satisfy a query
$ az storage entity query --filter [query_filter] [[-t|--table-name]] [table_name] --account-name [storage_account_name] --account-key [storage_account_key]
copy

Get an entity from the specified table
$ az storage entity show --partition-key [partition_key] --row-key [row_key] [[-t|--table-name]] [table_name] --account-name [storage_account_name] --account-key [storage_account_key]
copy

SYNOPSIS

az storage entity {delete|insert|merge|query|update} [--account-key] [--account-name] [--connection-string] [--sas-token] [--table-name] [subcommand options]

PARAMETERS

--account-key
    Storage account access key. Use anonymous for public blobs.

--account-name
    Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string
    Connection string. Overrides account-name and account-key.

--sas-token
    Shared access signature (SAS) token.

--table-name
    Table name.

--entity
    JSON formatted entity. Use '@file.json' for file input (insert/merge/update).

--filter
    OData filter expression (query).

--if-exists
    What if entity exists. Choices: fail, overwrite (insert/delete).

--marker
    Continuation token for pagination (query).

--num-results
    Return no more than this many results (query).

--partition-key
    Partition key (delete/update/merge).

--row-key
    Row key (delete/update/merge).

--select
    Comma-separated property names to select (query).

--top
    Return no more than this many results plus marker (query).

DESCRIPTION

The az storage entity command group in Azure CLI enables CRUD operations on entities in Azure Table Storage. It supports inserting new entities, updating or merging existing ones, deleting by partition and row keys, and querying with OData filters.

This is ideal for automating data workflows, testing, or bulk operations via scripts. Authentication uses storage account keys, SAS tokens, or connection strings. Entities are specified in JSON format with PartitionKey and RowKey required.

Operations are atomic, ensuring consistency. Query supports pagination via markers and limits results with top/select. Use with jq for JSON processing in pipelines. Requires Azure CLI 2.0+ and storage extension if preview features needed.

Common use: az storage entity insert --table-name MyTable --entity '@entity.json'. Enhances serverless data management without SDKs.

CAVEATS

Subcommand-specific options required (e.g., partition-key for delete). No bulk operations; script loops needed. Rate limits apply per storage account. JSON must include PartitionKey/RowKey.

SUBCOMMANDS

delete: Remove entity.
insert: Add new entity.
merge: Patch existing.
query: Retrieve with filters.
update: Replace existing.

EXAMPLE

Query: az storage entity query --table-name Tasks --filter "PartitionKey eq 'todo'" --select Priority,TaskName

HISTORY

Introduced in Azure CLI 2.1.0 (2018) with Table Storage support. Enhanced in 2.10+ for better OData querying and JSON handling. Active in current versions.

SEE ALSO

az storage table(1), az storage(1), jq(1)

Copied to clipboard