CSharpEssentials.GcpSecretManager 5.2.0

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

CSharpEssentials.GcpSecretManager

Integrates Google Cloud Secret Manager into the .NET Configuration system. Load secrets as standard IConfiguration values.

Features

  • Configuration Integration: Secrets appear as standard config keys.
  • Multi-Project: Load from multiple GCP projects.
  • AppSettings Support: Configure via appsettings.json or fluent API.
  • Batch Processing: Efficient retrieval with configurable batch sizes.
  • Transient Retry: Listing and per-secret access are retried on transient gRPC failures (uses CSharpEssentials.Resilience).

Installation

dotnet add package CSharpEssentials.GcpSecretManager

Usage

Setup via Code

using CSharpEssentials.GcpSecretManager;

builder.Configuration.AddGcpSecretManager(options =>
{
    options.AddProject(new ProjectSecretConfiguration
    {
        ProjectId = "my-gcp-project",
        PrefixFilters = new[] { "MyApp__" }
    });
});

string connectionString = builder.Configuration["MyApp:ConnectionStrings:Default"]!;

Logging

Configuration providers are built before dependency injection exists, so the provider does not resolve a logger on its own and writes nothing to the console by default. Pass an ILoggerFactory to get diagnostics (per-secret progress at Debug, failures at Error):

using CSharpEssentials.GcpSecretManager;

using ILoggerFactory loggerFactory = LoggerFactory.Create(b => b.AddConsole());

builder.Configuration.AddGcpSecretManager(options =>
{
    options.LoggerFactory = loggerFactory;
    options.AddProject(new ProjectSecretConfiguration { ProjectId = "my-gcp-project" });
});

SecretManagerConfigurationOptions is a sealed record; CredentialsPath, Loader, LoggerFactory and Projects are settable and AddProject returns the options for chaining.

Retries

Listing a project's secrets and accessing each secret version use CSharpEssentials.Resilience (RetryIfFailed with a shouldRetry predicate). Only ResourceExhausted and Unavailable are retried: 3 retries with exponential backoff (2s, 4s, 8s). Any other status, such as PermissionDenied or NotFound, fails immediately. When retries are exhausted the original RpcException is logged once at Error: a listing failure skips that project, an access failure skips that secret, and loading continues.

Setup via AppSettings

{
  "GoogleSecretManager": {
    "Projects": [
      { "ProjectId": "my-project", "PrefixFilters": ["Prod__"] }
    ]
  }
}
builder.Configuration.AddGcpSecretManager();

Key Mapping

GCP secrets use underscores; .NET config uses colons:

  • GCP: MyApp__ConnectionStrings__Default
  • .NET: MyApp:ConnectionStrings:Default
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 is compatible.  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.  net11.0 is compatible. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.5.2 55 10/10/2026
6.5.1 52 10/10/2026
6.5.0 57 10/9/2026
6.4.0 66 10/9/2026
6.3.0 74 10/8/2026
6.2.0 94 10/8/2026
6.1.0 95 10/7/2026
6.0.0 93 10/7/2026
5.2.1 99 10/7/2026
5.2.0 96 10/7/2026
5.1.0 91 10/7/2026
5.0.0 92 10/6/2026
4.1.0 96 10/6/2026
4.0.0 94 10/5/2026
3.2.3 197 5/31/2026
3.2.2 131 5/31/2026
3.2.1 126 5/31/2026
3.2.0 124 5/30/2026
3.1.0 138 5/27/2026
3.0.8 123 5/20/2026
Loading failed