# HostingExtensions.UseCosmosClustering(IServiceCollection, Action&lt;OptionsBuilder&lt;CosmosClusteringOptions&gt;&gt;)

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

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

```csharp
public static IServiceCollection UseCosmosClustering(this IServiceCollection services, Action<OptionsBuilder<CosmosClusteringOptions>> configureOptions)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

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

### Returns

The provided `services`.
