Tooark.Secrets.Gcp
4.7.0
dotnet add package Tooark.Secrets.Gcp --version 4.7.0
NuGet\Install-Package Tooark.Secrets.Gcp -Version 4.7.0
<PackageReference Include="Tooark.Secrets.Gcp" Version="4.7.0" />
<PackageVersion Include="Tooark.Secrets.Gcp" Version="4.7.0" />
<PackageReference Include="Tooark.Secrets.Gcp" />
paket add Tooark.Secrets.Gcp --version 4.7.0
#r "nuget: Tooark.Secrets.Gcp, 4.7.0"
#:package Tooark.Secrets.Gcp@4.7.0
#addin nuget:?package=Tooark.Secrets.Gcp&version=4.7.0
#tool nuget:?package=Tooark.Secrets.Gcp&version=4.7.0
Tooark.Secrets.Gcp
Tooark.Secrets provider on Google Cloud: it loads
Secret Manager secrets and Parameter Manager parameters into IConfiguration, and implements ISecretService
on Secret Manager.
The model, the common options and the conversion of names into keys are in the
Tooark.Secrets README. This README covers
what is specific to Google Cloud.
π Languages: πΊπΈ English (this file) Β· π§π· PortuguΓͺs
π Contents
- Installation
- Configuration
- Permissions
- Behavior on Google Cloud
- Dependencies
- Error Codes and Solutions
- Contributing
- Help & Security
- Support
- License
π§ Installation
dotnet add package Tooark.Secrets.Gcp
βοΈ Configuration
appsettings.json
{
"Secrets": {
"ProjectId": "arkuest",
"SecretsPrefix": "arkuest-prod",
"ParametersPrefix": "arkuest-prod"
}
}
Program.cs
using Tooark.Secrets.Gcp.Injections;
// Secrets and parameters in the configuration, on top of appsettings.json
builder.Configuration.AddTooarkSecretsGcp();
// Runtime secret reads, with cache
builder.Services.AddTooarkSecretsGcp(builder.Configuration);
The IConfigurationBuilder AddTooarkSecretsGcp requires SecretsPrefix, ParametersPrefix or both. The
IServiceCollection one registers ISecretService; the Secret Manager client is created on first use, and a
SecretManagerServiceClient already registered by the application is used instead.
GcpSecretsOptions properties
Besides the common options:
| Property | Type | Default | Description |
|---|---|---|---|
ProjectId |
string? |
β | Google Cloud project holding the secrets and parameters. Required |
SecretsPrefix |
string? |
β | Name prefix of the Secret Manager secrets that become configuration |
ParametersPrefix |
string? |
β | Name prefix of the Parameter Manager parameters (global location) that become configuration |
The credential always comes from Application Default Credentials: the Cloud Run, GKE or Compute Engine service
account, the GOOGLE_APPLICATION_CREDENTIALS variable, or gcloud auth application-default login in development.
There is no key in the options: the store credential cannot come from the store.
Names with a double underscore
Google only accepts letters, digits, _ and - in names, so levels use __:
| Secret or parameter | Key |
|---|---|
arkuest-prod__Jwt__Secret |
Jwt:Secret |
arkuest-prod__Storage__CredentialsJson |
Storage:CredentialsJson |
arkuest-prod__OpenId__Entra__ClientSecret |
OpenId:Entra:ClientSecret |
arkuest-prod, with ExpandJson |
the keys of the JSON document |
π Permissions
The application's identity needs:
| Role or permission | For |
|---|---|
roles/secretmanager.viewer on the project |
Listing the prefix's secrets |
roles/secretmanager.secretAccessor on the secrets |
Reading the secrets and ISecretService |
| Listing parameters, listing and rendering versions | Loading the Parameter Manager parameters |
A parameter that references Secret Manager secrets is rendered with the parameter's own identity, which needs to read those secrets.
π¦ Behavior on Google Cloud
- Secret Manager β the
latestversion of each secret applies. A secret without an enabled version is skipped. - Parameter Manager β the most recently created enabled version applies, because Parameter Manager has no
latestalias. The version is rendered: references to Secret Manager secrets arrive resolved. Only thegloballocation is read. - JSON parameter β with
ExpandJson, a parameter in JSON format becomes several keys. YAML parameters arrive as text. - Same name β with the same name in a secret and a parameter, the secret wins.
ISecretServiceβ the name is the secret's identifier in the options' project; a missing secret returns null.
π Dependencies
| Package | Version | Description |
|---|---|---|
Tooark.Secrets |
4.x | Model and configuration source |
Google.Cloud.SecretManager.V1 |
2.x | Secret Manager client |
Google.Cloud.ParameterManager.V1 |
1.x | Parameter Manager client |
Microsoft.Extensions.DependencyInjection.Abstractions |
8.x/10.x | Container registration |
β οΈ Error Codes and Solutions
The common errors are in the
Tooark.Secrets README.
A failure to load the source arrives as Secrets.LoadFailed;Google Cloud, with the Google error in InnerException.
| Message | Description | Solution |
|---|---|---|
Options.Secrets.Gcp.ProjectIdNotConfigured |
Missing ProjectId |
Configure Secrets:ProjectId |
Options.Secrets.Gcp.CredentialsUnavailable |
No Application Default Credentials in the environment | Run with a service account or configure local ADC |
π€ Contributing
Contributions are welcome! Start with CONTRIBUTING.md β it covers the development workflow, the coding and commit conventions and the pull request checklist. Bugs and feature requests go through the issue templates of the Tooark repository.
By participating you agree to the Code of Conduct.
π Help & Security
- β Questions, bugs, feature ideas β see SUPPORT.md for the right channel
- π Security vulnerabilities β do not open a public issue; follow SECURITY.md
π Support
If Tooark helps your projects, consider supporting its development:
- π GitHub Sponsors
- β Ko-fi
Every contribution helps keep the project maintained and improving. Thank you! π
π License
This project is licensed under the BSD 3-Clause License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 was computed. 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. |
-
net10.0
- Google.Cloud.ParameterManager.V1 (>= 1.1.0)
- Google.Cloud.SecretManager.V1 (>= 2.8.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.12)
- Tooark.Secrets (>= 4.7.0)
-
net8.0
- Google.Cloud.ParameterManager.V1 (>= 1.1.0)
- Google.Cloud.SecretManager.V1 (>= 2.8.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Tooark.Secrets (>= 4.7.0)
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 |
|---|---|---|
| 4.7.0 | 87 | 9/30/2026 |