← 返回命令列表

Linux command

az-storage-entity 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Insert an entity

az storage entity insert --table-name [MyTable] --entity PartitionKey=[pk] RowKey=[rk] Property=[value] --account-name [mystorageaccount]

Insert with conflict handling

az storage entity insert --table-name [MyTable] --entity PartitionKey=[pk] RowKey=[rk] Property=[value] --if-exists [merge] --connection-string [$CS]

Query entities

az storage entity query --table-name [MyTable] --account-name [mystorageaccount]

Query with OData filter

az storage entity query --table-name [MyTable] --filter "PartitionKey eq 'pk'" --account-name [mystorageaccount]

Show a specific entity

az storage entity show --table-name [MyTable] --partition-key [pk] --row-key [rk] --account-name [mystorageaccount]

Merge entity properties

az storage entity merge --table-name [MyTable] --entity PartitionKey=[pk] RowKey=[rk] Property=[newvalue] --account-name [mystorageaccount]

Replace an entity

az storage entity replace --table-name [MyTable] --entity PartitionKey=[pk] RowKey=[rk] Property=[newvalue] --account-name [mystorageaccount]

Delete an entity

az storage entity delete --table-name [MyTable] --partition-key [pk] --row-key [rk] --account-name [mystorageaccount]

说明

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`).

参数

-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: `AZURE_STORAGE_ACCOUNT`.
--account-key _KEY_
Storage account key. Env: `AZURE_STORAGE_KEY`.
--connection-string _CS_
Storage account connection string. Env: `AZURE_STORAGE_CONNECTION_STRING`.
--sas-token _TOKEN_
Shared Access Signature token. Env: `AZURE_STORAGE_SAS_TOKEN`.
--auth-mode _MODE_
Authentication mode: `key` (legacy) or `login` (Azure AD).
--table-endpoint _URL_
Custom service endpoint, useful for Cosmos DB Table API.

FAQ

What is the az-storage-entity command used for?

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`).

How do I run a basic az-storage-entity example?

Run `az storage entity insert --table-name [MyTable] --entity PartitionKey=[pk] RowKey=[rk] Property=[value] --account-name [mystorageaccount]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -t, --table-name _NAME_ do in az-storage-entity?

Name of the table.