The documentation you are viewing is for Dapr v1.4 which is an older version of Dapr. For up-to-date documentation, see the latest version.

Azure Table Storage

Detailed information on the Azure Table Storage state store component

Component format

To setup Azure Tablestorage state store create a component of type state.azure.tablestorage. See this guide on how to create and apply a state store configuration.

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: <NAME>
  namespace: <NAMESPACE>
spec:
  type: state.azure.tablestorage
  version: v1
  metadata:
  - name: accountName
    value: <REPLACE-WITH-ACCOUNT-NAME>
  - name: accountKey
    value: <REPLACE-WITH-ACCOUNT-KEY>
  - name: tableName
    value: <REPLACE-WITH-TABLE-NAME>

Spec metadata fields

Field Required Details Example
accountName Y The storage account name "mystorageaccount".
accountKey Y Primary or secondary storage key "key"
tableName Y The name of the table to be used for Dapr state. The table will be created for you if it doesn’t exist "table"

Setup Azure Table Storage

Follow the instructions from the Azure documentation on how to create an Azure Storage Account.

If you wish to create a table for Dapr to use, you can do so beforehand. However, Table Storage state provider will create one for you automatically if it doesn’t exist.

In order to setup Azure Table Storage as a state store, you will need the following properties:

  • AccountName: The storage account name. For example: mystorageaccount.
  • AccountKey: Primary or secondary storage key.
  • TableName: The name of the table to be used for Dapr state. The table will be created for you if it doesn’t exist.

Partitioning

The Azure Table Storage state store uses the key property provided in the requests to the Dapr API to determine the row key. Service Name is used for partition key. This provides best performance, as each service type stores state in it’s own table partition.

This state store creates a column called Value in the table storage and puts raw state inside it.

For example, the following operation coming from service called myservice

curl -X POST http://localhost:3500/v1.0/state \
  -H "Content-Type: application/json"
  -d '[
        {
          "key": "nihilus",
          "value": "darth"
        }
      ]'

will create the following record in a table:

PartitionKey RowKey Value
myservice nihilus darth

Concurrency

Azure Table Storage state concurrency is achieved by using ETags according to the official documentation.


Last modified July 12, 2022 : update nav bar for v1.4 (#2641) (2db803e)