AzureKeyVaultEmulator.Aspire.Hosting 3.1.0

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

Overview

Provides the ability to emulate the AzureKeyVault Aspire resource using the open source emulator.

Recommended, but not required, is the client library to make using the emulator in your applications incredibly simple.

Usage

Install the package to your .NET Aspire AppHost project:

dotnet add package AzureKeyVaultEmulator.Aspire.Hosting

Next you can either redirect an existing AzureKeyVaultResource to use the emulator, or directly include it without needing any Azure configuration.

To redirect an existing resource:

var keyVaultServiceName = "keyvault";

var keyVault = builder
    .AddAzureKeyVault(keyVaultServiceName)
    .RunAsEmulator(); // Add this line

    var webApi = builder
    .AddProject<Projects.MyApi>("api")
    .WithReference(keyvault); // reference as normal

To use directly without needing to set up any Azure configuration:

var keyVaultServiceName = "keyvault";

var keyVault = builder.AddAzureKeyVaultEmulator(keyVaultServiceName);

You will then have a feature complete, emulated Azure Key Vault running locally:

Azure Key Vault Emulator in .NET Aspire

Using DefaultAzureCredential

If your consumer authenticates with Azure.Identity.DefaultAzureCredential (so it doesn't need to depend on the emulator-specific client library), add WithAzureKeyVaultEmulatorCredentials in the AppHost. Everything is wired up automatically — credentials, tenant, and authority all flow into the consumer for you (the host machine's AZURE_TENANT_ID is picked up automatically when set):

// AppHost
var keyVault = builder.AddAzureKeyVaultEmulator("keyvault");

builder.AddProject<Projects.MyApi>("api")
    .WithAzureKeyVaultEmulatorCredentials(keyVault)
    .WithReference(keyVault);

The only consumer-side settings the SDK still requires are DisableInstanceDiscovery = true and DisableChallengeResourceVerification = true (the emulator runs on localhost rather than *.vault.azure.net):

var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions
{
    DisableInstanceDiscovery = true,
});

builder.Services.AddSingleton(_ => new SecretClient(
    new Uri(vaultUri),
    credential,
    new SecretClientOptions { DisableChallengeResourceVerification = true }));
Product 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 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. 
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 (1)

Showing the top 1 popular GitHub repositories that depend on AzureKeyVaultEmulator.Aspire.Hosting:

Repository Stars
FritzAndFriends/TagzApp
An application that discovers content on social media for hashtags
Version Downloads Last Updated
3.1.0 40 5/16/2026
3.0.1 72 5/15/2026
3.0.0 1,052 5/9/2026
2.9.1 750 5/8/2026
2.9.0 20,991 3/23/2026
2.8.4 23,399 2/3/2026
2.8.3 4,229 1/22/2026
2.8.2 6,691 1/14/2026
2.8.1 261 1/13/2026
2.8.0 2,305 1/10/2026
2.7.8 12,682 12/21/2025
2.7.7 1,122 12/16/2025
2.7.6 532 12/15/2025 2.7.6 is deprecated because it has critical bugs.
2.7.5 4,777 12/6/2025
2.7.4 839 12/4/2025
2.7.3 3,329 11/20/2025
2.7.2 500 11/19/2025
2.7.1 777 11/19/2025
2.7.0 11,182 11/5/2025
2.6.6 8,364 10/16/2025
Loading failed