Vault.Extension.Configuration
0.2.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Vault.Extension.Configuration --version 0.2.2
NuGet\Install-Package Vault.Extension.Configuration -Version 0.2.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="Vault.Extension.Configuration" Version="0.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vault.Extension.Configuration" Version="0.2.2" />
<PackageReference Include="Vault.Extension.Configuration" />
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 Vault.Extension.Configuration --version 0.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Vault.Extension.Configuration, 0.2.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 Vault.Extension.Configuration@0.2.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=Vault.Extension.Configuration&version=0.2.2
#tool nuget:?package=Vault.Extension.Configuration&version=0.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Vault.Extension.Configuration
A configuration extension for Microsoft.Extensions.Configuration that integrates with HashiCorp Vault using VaultSharp
Features
- 🔐 Multiple authentication methods: Local token, AWS IAM, or custom authentication
- ⚙️ Seamless integration with
Microsoft.Extensions.Configuration - 🔄 Secret loading into configuration at startup
- ✅ Fluent validation for configuration options
- 🏗️ Dependency injection support
Installation
dotnet add package Vault.Extension.Configuration
Quick Start
Basic Usage with Local Token
var builder = WebApplication.CreateBuilder(args);
builder.AddVault(options =>
{
options.AuthenticationType = VaultAuthenticationType.Local;
options.Configuration = new VaultLocalConfiguration
{
VaultUrl = "https://vault.example.com",
MountPoint = "secret",
TokenFilePath = "~/.vault-token"
};
}, environment: "production");
var app = builder.Build();
AWS IAM Authentication
builder.AddVault(options =>
{
options.AuthenticationType = VaultAuthenticationType.AWS_IAM;
options.Configuration = new VaultAwsConfiguration
{
VaultUrl = "https://vault.example.com",
MountPoint = "secret",
Environment = "production",
AwsAuthMountPoint = "aws",
AwsIamRoleName = "my-app-role" // Optional, defaults to {MountPoint}-{Environment}-role
};
}, environment: "production");
Custom Authentication
For authentication methods not natively supported (AppRole, LDAP, UserPass, etc.):
builder.AddVault(options =>
{
options.AuthenticationType = VaultAuthenticationType.Custom;
options.Configuration = new VaultDefaultConfiguration
{
VaultUrl = "https://vault.example.com",
MountPoint = "secret"
};
options.CustomAuthMethodInfo = new AppRoleAuthMethodInfo(roleId, secretId);
}, environment: "production");
Configuration Options
VaultOptions
| Property | Type | Description |
|---|---|---|
AuthenticationType |
VaultAuthenticationType |
Authentication method (Local, AWS_IAM, Custom) |
Configuration |
VaultDefaultConfiguration |
Vault connection configuration |
CustomAuthMethodInfo |
IAuthMethodInfo |
Custom authentication (only for Custom type) |
VaultLocalConfiguration
| Property | Type | Description |
|---|---|---|
VaultUrl |
string |
Vault server URL |
MountPoint |
string |
Secret engine mount point |
TokenFilePath |
string |
Path to the token file |
IgnoreSslErrors |
bool |
Ignore SSL certificate errors |
VaultAwsConfiguration
| Property | Type | Description |
|---|---|---|
VaultUrl |
string |
Vault server URL |
MountPoint |
string |
Secret engine mount point |
Environment |
string |
Environment name (used for role naming) |
AwsAuthMountPoint |
string |
AWS auth method mount point (default: "aws") |
AwsIamRoleName |
string |
AWS IAM role name (optional) |
IgnoreSslErrors |
bool |
Ignore SSL certificate errors |
Advanced Usage
Using IVaultService Directly
public class MyService
{
private readonly IVaultService _vaultService;
public MyService(IVaultService vaultService)
{
_vaultService = vaultService;
}
public async Task<string> GetSecretAsync(string key)
{
var secretValue = await _vaultService.GetSecretValueAsync("production", key);
return secretValue?.ToString() ?? throw new InvalidOperationException($"Secret '{key}' not found");
}
public async Task<Dictionary<string, object>> GetAllSecretsAsync()
{
return await _vaultService.GetSecretsAsync("production");
}
}
Loading Secrets with Prefix
builder.AddVault(options => { /* ... */ },
environment: "production",
sectionPrefix: "MyApp",
addUnregisteredEntries: true);
Requirements
- .NET 8.0 or later
- HashiCorp Vault server
- VaultSharp (included as dependency)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
See CONTRIBUTING.md for guidelines.
Template Information
<details> <summary>Click to expand template documentation</summary>
This project is based on Library.Template.
Build Features
- Auto-versioning via Nerdbank.GitVersioning
- Static analyzers: Code Analysis and StyleCop
- Read-only source tree (builds to top-level bin/obj folders)
- Builds with a "pinned" .NET SDK for reproducible builds
- Testing on Windows, Linux and macOS
Maintaining your repo based on this template
git fetch
git checkout origin/main
.\tools\MergeFrom-Template.ps1
# resolve any conflicts, then commit the merge commit.
git push origin -u HEAD
</details>
| 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 was computed. 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.
-
net8.0
- AWSSDK.Core (>= 4.0.3.4)
- FluentValidation.DependencyInjectionExtensions (>= 12.1.1)
- Microsoft.Extensions.Configuration (>= 10.0.1)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- VaultSharp (>= 1.17.5.1)
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 |
|---|---|---|
| 0.4.2 | 114 | 1/20/2026 |
| 0.3.7 | 100 | 1/19/2026 |
| 0.3.3 | 109 | 1/9/2026 |
| 0.3.1 | 110 | 1/7/2026 |
| 0.2.2 | 182 | 12/22/2025 |
| 0.2.1-beta | 179 | 12/22/2025 |
| 0.1.3 | 175 | 12/22/2025 |
| 0.1.1-beta | 175 | 12/22/2025 |
| 0.0.8-g7f68ca5f0e | 177 | 12/22/2025 |
| 0.0.0 | 177 | 12/22/2025 |