CSharpEssentials.GcpSecretManager 3.0.2

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

CSharpEssentials.GcpSecretManager

CSharpEssentials.GcpSecretManager integrates Google Cloud Secret Manager into the .NET Configuration system. It allows you to load secrets directly into IConfiguration, making them accessible via standard dependency injection options patterns.

🚀 Features

  • Configuration Integration: Secrets appear as standard configuration values (e.g., ConnectionStrings:Default).
  • Multi-Project Support: Load secrets from multiple Google Cloud projects.
  • Flexible Configuration: Configure via appsettings.json or fluent API code.
  • Batch Processing: Efficient secret retrieval with configurable batch sizes.
  • Credentials Handling: Supports standard Google Application Credentials or explicit file paths.

📦 Installation

dotnet add package CSharpEssentials.GcpSecretManager

🛠 Usage

1. Setup via Code

Add Secret Manager in your Program.cs (or Startup.cs).

using CSharpEssentials.GcpSecretManager;

var builder = WebApplication.CreateBuilder(args);

builder.Configuration.AddGcpSecretManager(options =>
{
    options.CredentialsPath = "path/to/key.json"; // Optional, uses default if null
    
    options.AddProject(new ProjectSecretConfiguration
    {
        ProjectId = "my-gcp-project-id",
        Prefix = "MyApp" // Optional: Filter secrets starting with this
    });
});

// Now access secrets as config
string dbConn = builder.Configuration["MyApp_ConnectionStrings_Db"];

2. Setup via AppSettings

You can define the configuration in appsettings.json and let the library load it automatically.

appsettings.json:

{
  "GoogleSecretManager": {
    "Projects": [
      {
        "ProjectId": "my-production-project",
        "Prefix": "Prod",
        "Exclude": ["Internal_"]
      }
    ]
  }
}

Program.cs:

// Automatically loads from "GoogleSecretManager" section
builder.Configuration.AddGcpSecretManager(); 

3. Key Mapping

Secrets in GCP are typically named with underscores or dashes. This library maps them to .NET configuration keys.

  • GCP Secret: MyApp__ConnectionStrings__Default
  • .NET Config: MyApp:ConnectionStrings:Default

(Note: Double underscores __ are standard separators in .NET configuration providers).

4. Performance Tuning

Adjust batch sizes for large numbers of secrets.

options.BatchSize = 20;
options.PageSize = 500;
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
3.0.5 90 5/7/2026
3.0.4 91 5/6/2026
3.0.3 91 5/5/2026
3.0.2 100 5/5/2026
3.0.1 92 5/3/2026
3.0.0 91 5/3/2026
2.1.0 1,406 11/26/2025
2.0.9 230 9/30/2025
2.0.8 227 9/29/2025
2.0.7 206 9/29/2025
2.0.6 212 9/29/2025
2.0.5 223 9/29/2025
2.0.4 210 9/28/2025
2.0.3 210 9/28/2025
2.0.2 197 9/28/2025
2.0.1 211 9/28/2025
2.0.0 213 9/28/2025
1.0.5 281 1/30/2025
1.0.4 182 1/29/2025
Loading failed