Soenneker.Cosmos.Database.Setup 4.0.2355

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Cosmos.Database.Setup --version 4.0.2355
                    
NuGet\Install-Package Soenneker.Cosmos.Database.Setup -Version 4.0.2355
                    
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="Soenneker.Cosmos.Database.Setup" Version="4.0.2355" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Cosmos.Database.Setup" Version="4.0.2355" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Cosmos.Database.Setup" />
                    
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 Soenneker.Cosmos.Database.Setup --version 4.0.2355
                    
#r "nuget: Soenneker.Cosmos.Database.Setup, 4.0.2355"
                    
#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 Soenneker.Cosmos.Database.Setup@4.0.2355
                    
#: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=Soenneker.Cosmos.Database.Setup&version=4.0.2355
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Cosmos.Database.Setup&version=4.0.2355
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Cosmos.Database.Setup

Creates an Azure Cosmos DB database when it does not exist and optionally updates its shared throughput.

Installation

dotnet add package Soenneker.Cosmos.Database.Setup

Configuration

{
  "Azure": {
    "Cosmos": {
      "Endpoint": "https://your-account.documents.azure.com:443/",
      "AccountKey": "your-account-key",
      "DatabaseName": "app",
      "DatabaseThroughput": 1000,
      "DatabaseThroughputType": "autoscale",
      "ReplaceDatabaseThroughput": false
    }
  }
}

DatabaseThroughputType is case-insensitive. The value autoscale creates autoscale throughput; every other value selects manual throughput. DatabaseThroughput and DatabaseThroughputType are required for both Ensure overloads because throughput is read from configuration.

When ReplaceDatabaseThroughput is false or omitted, throughput is supplied only if the database must be created. When it is true, the configured throughput is also applied to an existing database after it is resolved.

Registration and use

using Soenneker.Cosmos.Database.Setup.Abstract;
using Soenneker.Cosmos.Database.Setup.Registrars;

services.AddCosmosDatabaseSetupUtilAsSingleton();

ICosmosDatabaseSetupUtil setup = serviceProvider.GetRequiredService<ICosmosDatabaseSetupUtil>();
Microsoft.Azure.Cosmos.Database database = await setup.Ensure(cancellationToken);

Ensure() reads the endpoint, account key, and database name from Azure:Cosmos. To provide those values per call:

Microsoft.Azure.Cosmos.Database database = await setup.Ensure(
    endpoint,
    accountKey,
    "app",
    cancellationToken);

AddCosmosDatabaseSetupUtilAsScoped() is also available. Both registrations add the Cosmos client utility as a singleton.

Transient request timeouts, throttling, HTTP failures, and selected Cosmos service errors are retried five times with exponential backoff and jitter. Authentication, authorization, invalid configuration, exhausted retries, throughput replacement failures, and cancellation propagate to the caller.

Product Compatible and additional computed target framework versions.
.NET 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 (1)

Showing the top 1 NuGet packages that depend on Soenneker.Cosmos.Database.Setup:

Package Downloads
Soenneker.Cosmos.Database

A utility library for storing Azure Cosmos databases

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.2368 335 9/18/2026
4.0.2367 338 9/17/2026
4.0.2366 180 9/17/2026
4.0.2365 146 9/16/2026
4.0.2364 217 9/16/2026
4.0.2363 121 9/16/2026
4.0.2362 182 9/16/2026
4.0.2361 294 9/16/2026
4.0.2360 116 9/15/2026
4.0.2359 144 9/15/2026
4.0.2358 641 9/13/2026
4.0.2357 88 9/13/2026
4.0.2356 102 9/13/2026
4.0.2355 404 9/13/2026
4.0.2354 258 9/13/2026
4.0.2353 219 9/12/2026
4.0.2352 119 9/12/2026
4.0.2351 331 9/12/2026
4.0.2350 98 9/12/2026
4.0.2349 237 9/12/2026
Loading failed

Update dependency Soenneker.Cosmos.Client to 4.0.3728 (#3041)