title: Azure Storage Grain Persistence

Azure Storage Grain Persistence

The Azure Storage grain persistence provider supports both Azure Blob Storage and Azure Table Storage.

Installation

Install the Microsoft.Orleans.Persistence.AzureStorage package from NuGet.

Configuration

Azure Table Storage

The Azure Table Storage provider stores state in a table row, splitting the state over multiple columns if the limits of a single column are exceeded. Each row can hold a maximum length of one megabyte, as imposed by Azure Table Storage.

Configure the Azure Table Storage grain persistence provider using the ISiloBuilder.AddAzureTableGrainStorage extension methods.

  1. siloBuilder.AddAzureTableGrainStorage(
  2. name: "profileStore",
  3. configureOptions: options =>
  4. {
  5. options.UseJson = true;
  6. options.ConnectionString = "DefaultEndpointsProtocol=https;AccountName=data1;AccountKey=SOMETHING1";
  7. });

Azure Blob Storage

The Azure Blob Storage provider stores state in a blob.

Configure the Azure Blob Storage grain persistence provider using the ISiloBuilder.AddAzureBlobGrainStorage extension methods.

  1. siloBuilder.AddAzureBlobGrainStorage(
  2. name: "profileStore",
  3. configureOptions: options =>
  4. {
  5. options.UseJson = true;
  6. options.ConnectionString = "DefaultEndpointsProtocol=https;AccountName=data1;AccountKey=SOMETHING1";
  7. });