LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

az-storage-entity

Manage entities in Azure Table Storage

TLDR

Insert an entity into a table
$ az storage entity insert --table-name [MyTable] --entity PartitionKey=[pk] RowKey=[rk] Property=[value] --account-name [mystorageaccount]
copy
Insert with conflict handling (fail, merge, or replace)
$ az storage entity insert --table-name [MyTable] --entity PartitionKey=[pk] RowKey=[rk] Property=[value] --if-exists [merge] --connection-string [$CS]
copy
Query entities from a table
$ az storage entity query --table-name [MyTable] --account-name [mystorageaccount]
copy
Query with OData filter
$ az storage entity query --table-name [MyTable] --filter "PartitionKey eq 'pk'" --account-name [mystorageaccount]
copy
Show a specific entity
$ az storage entity show --table-name [MyTable] --partition-key [pk] --row-key [rk] --account-name [mystorageaccount]
copy
Merge entity properties
$ az storage entity merge --table-name [MyTable] --entity PartitionKey=[pk] RowKey=[rk] Property=[newvalue] --account-name [mystorageaccount]
copy
Replace an entity
$ az storage entity replace --table-name [MyTable] --entity PartitionKey=[pk] RowKey=[rk] Property=[newvalue] --account-name [mystorageaccount]
copy
Delete an entity
$ az storage entity delete --table-name [MyTable] --partition-key [pk] --row-key [rk] --account-name [mystorageaccount]
copy

SYNOPSIS

az storage entity subcommand [options]

DESCRIPTION

az storage entity manages entities in Azure Table Storage. Table Storage is a NoSQL key-value store for structured data. Entities are items stored in tables, similar to rows in a database, uniquely identified by `PartitionKey` and `RowKey`.This command works with both Azure Storage accounts and Azure Cosmos DB Table API (via `--table-endpoint`).

PARAMETERS

-t, --table-name NAME

Name of the table.
-e, --entity KEY=VAL ...
Space-separated `key=value` pairs. Must include `PartitionKey` and `RowKey`. Append `key@odata.type=<EdmType>` to set explicit Edm types (Edm.String, Edm.Int32, Edm.Int64, Edm.Double, Edm.Boolean, Edm.DateTime, Edm.Guid, Edm.Binary).
--partition-key PK
Partition key of the entity.
--row-key RK
Row key of the entity.
--filter EXPR
OData filter expression for `query`.
--select PROPS
Space-separated list of properties to return.
--num-results N
Number of entities returned per service request.
--marker NEXTPK=... NEXTRK=...
Continuation marker for paged queries.
--if-exists BEHAVIOR
Behavior when an entity already exists: `fail` (default), `merge`, or `replace` (insert only).
--if-match ETAG
Perform the operation only if the entity's ETag matches. Default `*`.
--account-name NAME
Storage account name. Env: `AZURESTORAGEACCOUNT`.
--account-key KEY
Storage account key. Env: `AZURESTORAGEKEY`.
--connection-string CS
Storage account connection string. Env: `AZURESTORAGECONNECTION_STRING`.
--sas-token TOKEN
Shared Access Signature token. Env: `AZURESTORAGESAS_TOKEN`.
--auth-mode MODE
Authentication mode: `key` (legacy) or `login` (Azure AD).
--table-endpoint URL
Custom service endpoint, useful for Cosmos DB Table API.

SUBCOMMANDS

insert

Insert an entity into a table.
delete
Delete an entity from a table.
merge
Update an entity by merging properties.
replace
Update an entity by replacing it entirely.
query
List entities matching a query.
show
Get a single entity from a table.

CAVEATS

Requires Azure CLI and valid storage credentials. Property types are limited to the Edm type system. Queries return up to 1000 entities per request; use `--marker` for pagination. The PartitionKey and RowKey may be up to 64KB each.

SEE ALSO

Copied to clipboard
Kai