Microsoft.Orleans.Persistence.AzureStorage 10.0.1

Prefix Reserved
dotnet add package Microsoft.Orleans.Persistence.AzureStorage --version 10.0.1
                    
NuGet\Install-Package Microsoft.Orleans.Persistence.AzureStorage -Version 10.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.Orleans.Persistence.AzureStorage" Version="10.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Orleans.Persistence.AzureStorage" Version="10.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.Orleans.Persistence.AzureStorage" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.Orleans.Persistence.AzureStorage --version 10.0.1
                    
#r "nuget: Microsoft.Orleans.Persistence.AzureStorage, 10.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsoft.Orleans.Persistence.AzureStorage@10.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.Orleans.Persistence.AzureStorage&version=10.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Orleans.Persistence.AzureStorage&version=10.0.1
                    
Install as a Cake Tool

Microsoft Orleans Persistence for Azure Storage

Introduction

Microsoft Orleans Persistence for Azure Storage provides grain persistence for Microsoft Orleans using Azure Storage (Blob and Table). This allows your grains to persist their state in Azure Storage and reload it when they are reactivated.

Getting Started

To use this package, install it via NuGet:

dotnet add package Microsoft.Orleans.Persistence.AzureStorage

Example - Configuring Azure Storage Persistence

using Microsoft.Extensions.Hosting;
using Orleans.Configuration;
using Orleans.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;

// Define grain interface
public interface IMyGrain : IGrainWithStringKey
{
    Task SetData(string data);
    Task<string> GetData();
}


var builder = Host.CreateApplicationBuilder(args)
    .UseOrleans(siloBuilder =>
    {
        siloBuilder
            .UseLocalhostClustering()
            // Configure Azure Table Storage as grain storage
            .AddAzureTableGrainStorage(
                name: "tableStore",
                configureOptions: options =>
                {
                    options.ConnectionString = "YOUR_AZURE_STORAGE_CONNECTION_STRING";
                })
            // Configure Azure Blob Storage as grain storage
            .AddAzureBlobGrainStorage(
                name: "blobStore",
                configureOptions: options =>
                {
                    options.ConnectionString = "YOUR_AZURE_STORAGE_CONNECTION_STRING";
                });
    });

var host = builder.Build();
await host.StartAsync();

// Get a reference to a grain and call it
var client = host.Services.GetRequiredService<IClusterClient>();
var grain = client.GetGrain<IMyGrain>("user123");
await grain.SetData("Hello from Azure Storage!");
var response = await grain.GetData();

// Print the result
Console.WriteLine($"Grain data: {response}");

// Keep the host running until the application is shut down
await host.WaitForShutdownAsync();

Example - Using Grain Storage in a Grain

using System;
using System.Threading.Tasks;
using Orleans;
using Orleans.Runtime;
namespace ExampleGrains;

// Define grain state class

public class MyGrainState
{
    public string Data { get; set; }
    public int Version { get; set; }
}

// Grain implementation that uses the Azure storage
public class MyGrain : Grain, IMyGrain, IGrainWithStringKey
{
    private readonly IPersistentState<MyGrainState> _state;

    public MyGrain([PersistentState("state", "tableStore")] IPersistentState<MyGrainState> state)
    {
        _state = state;
    }

    public async Task SetData(string data)
    {
        _state.State.Data = data;
        _state.State.Version++;
        await _state.WriteStateAsync();
    }

    public Task<string> GetData()
    {
        return Task.FromResult(_state.State.Data);
    }
}

Documentation

For more comprehensive documentation, please refer to:

Feedback & Contributing

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

Showing the top 5 NuGet packages that depend on Microsoft.Orleans.Persistence.AzureStorage:

Package Downloads
Blauhaus.Orleans

Package Description

Blauhaus.EVACS.Orleans

Package Description

Microsoft.Orleans.OrleansAzureUtils

Support library for hosting Orleans on Microsoft Azure.

Orleans.Contrib.UniversalSilo

This library provides primitives to set up a configurable, application-agnostic Orleans silo and clients. Use it with the Orleans.Contrib.UniversalSilo.Templates to get started with Orleans.

Nabs.Launchpad.Core.Silo

Package Description

GitHub repositories (7)

Showing the top 7 popular GitHub repositories that depend on Microsoft.Orleans.Persistence.AzureStorage:

Repository Stars
dotnet/aspire
Aspire is the tool for code-first, extensible, observable dev and deploy.
dotnet/samples
Sample code referenced by the .NET documentation
Dotnet-Boxed/Templates
.NET project templates with batteries included, providing the minimum amount of code required to get you going faster.
microsoft/dotnet-podcasts
.NET reference application shown at .NET Conf featuring ASP.NET Core, Blazor, .NET MAUI, Microservices, Orleans, Playwright, and more!
J-Tech-Japan/Sekiban
Sekiban - an Opinionated Event Sourcing and CQRS Framework using C#. It can store data into Azure Cosmos DB, AWS Dynamo DB or Postgres
Samsung/Tizen.NET
Welcome to Tizen .NET
ReubenBond/hanbaobao-web
Orleans sample application with Kubernetes hosting
Version Downloads Last Updated
10.0.1 4,728 2/7/2026
10.0.0 15,962 1/20/2026
10.0.0-rc.2 738 12/31/2025
9.2.1 164,234 7/16/2025
9.2.0 2,135 7/14/2025
9.2.0-preview3 753 6/10/2025
9.2.0-preview2 254 6/4/2025
9.2.0-preview1 5,975 4/4/2025
9.1.2 149,922 2/13/2025
9.0.1 39,940 11/23/2024
9.0.0 3,948 11/14/2024
8.2.0 168,787 7/12/2024
7.2.7 8,171 10/15/2024
3.8.0 3,737 5/6/2025
3.8.0-preview5 345 5/12/2025
3.8.0-preview3 302 4/8/2025
3.8.0-preview2 263 4/4/2025
3.8.0-preview1 288 3/31/2025
Loading failed