CommonKeyVaultServices 1.0.0

dotnet add package CommonKeyVaultServices --version 1.0.0
                    
NuGet\Install-Package CommonKeyVaultServices -Version 1.0.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="CommonKeyVaultServices" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommonKeyVaultServices" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CommonKeyVaultServices" />
                    
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 CommonKeyVaultServices --version 1.0.0
                    
#r "nuget: CommonKeyVaultServices, 1.0.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 CommonKeyVaultServices@1.0.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=CommonKeyVaultServices&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CommonKeyVaultServices&version=1.0.0
                    
Install as a Cake Tool

CommonKeyVaultServices

A reusable .NET library for integrating Azure Key Vault into applications with minimal setup.

Features

  • Azure Key Vault configuration bootstrap
  • SecretClient registration for dependency injection
  • Support for DefaultAzureCredential and ClientSecretCredential
  • SQL Server Always Encrypted Azure Key Vault provider registration
  • Configuration via strongly typed KeyVaultOptions
  • Compatible with ASP.NET Core, Azure Functions, Console Applications, and Class Libraries

Installation

Install the package from NuGet:

dotnet add package CommonKeyVaultServices

Basic Usage

Register Services

builder.Services.AddSharedKeyVaultServices(options =>
{
    options.VaultName = configuration["KeyVault:VaultName"];
    options.CredentialMode = "ClientSecret";
    options.TenantId = configuration["KeyVault:TenantId"];
    options.ClientId = configuration["KeyVault:ClientId"];
    options.ClientSecret = configuration["KeyVault:ClientSecret"];
});

Initialize Key Vault

builder.Configuration.AddSharedKeyVault(options =>
{
    options.VaultName = configuration["KeyVault:VaultName"];
    options.CredentialMode = "ClientSecret";
    options.TenantId = configuration["KeyVault:TenantId"];
    options.ClientId = configuration["KeyVault:ClientId"];
    options.ClientSecret = configuration["KeyVault:ClientSecret"];
});

Read Secrets

public class MyService
{
    private readonly IKeyVaultSecretReader _secretReader;

    public MyService(IKeyVaultSecretReader secretReader)
    {
        _secretReader = secretReader;
    }

    public async Task<string> GetSecretAsync()
    {
        return await _secretReader.GetSecretAsync("MySecret");
    }
}

Supported Credential Modes

Default

Uses Azure DefaultAzureCredential.

{
  "KeyVault": {
    "CredentialMode": "Default",
    "VaultName": "my-key-vault"
  }
}

ClientSecret

Uses Azure ClientSecretCredential.

{
  "KeyVault": {
    "CredentialMode": "ClientSecret",
    "VaultName": "my-key-vault",
    "TenantId": "<tenant-id>",
    "ClientId": "<client-id>",
    "ClientSecret": "<client-secret>"
  }
}

SQL Always Encrypted

The library can register the Azure Key Vault provider required by SQL Server Always Encrypted.

builder.InitializeSharedKeyVault(options =>
{
    // configuration
});

Requirements

  • .NET 10 or later
  • Azure Key Vault
  • Appropriate Azure permissions for the selected credential type

Security

This package does not contain or store credentials, secrets, connection strings, tenant IDs, or vault information.

All credentials must be supplied by the consuming application.

Versioning

This project follows Semantic Versioning.

  • Patch: Bug fixes (1.0.1)
  • Minor: Backward-compatible features (1.1.0)
  • Major: Breaking changes (2.0.0)

License

MIT License

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 CommonKeyVaultServices:

Package Downloads
DoCommon_V3

Shared QuickBase integration, centralized logging, and Central Identity services.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 156 5/29/2026