# HostingExtensions.AddCosmosGrainStorage(IServiceCollection, string, Action&lt;OptionsBuilder&lt;CosmosGrainStorageOptions&gt;&gt;)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.persistence.cosmos/orleans.hosting.hostingextensions/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.persistence.cosmos/orleans.hosting.hostingextensions/methods/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Persistence.Cosmos/HostingExtensions.cs)

```csharp
public static IServiceCollection AddCosmosGrainStorage(this IServiceCollection services, string name, Action<OptionsBuilder<CosmosGrainStorageOptions>>? configureOptions = null)
```

Configure silo to use Azure Cosmos DB storage for grain storage.

### Parameters

- `services` (`IServiceCollection`): The service collection.
- `name` (`string`): The storage provider name.
- `configureOptions` (`Action<OptionsBuilder<CosmosGrainStorageOptions>>`): The delegate used to configure the provider.
