Aspire.Hosting.Azure.KeyVault 13.5.2

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

Azure Key Vault hosting integration

Use this integration to model, configure, and provision Azure Key Vault resources in an Aspire solution.

Getting started

Prerequisites

Add the integration

From your AppHost directory, add the Aspire.Hosting.Azure.KeyVault integration with the Aspire CLI:

aspire add Aspire.Hosting.Azure.KeyVault

Configure Azure Provisioning for local development

Adding Azure resources to the AppHost model will automatically enable development-time provisioning for Azure resources so that you don't need to configure them manually. Provisioning requires a number of settings to be available via AppHost configuration. From your AppHost directory, set these values with aspire secret set:

aspire secret set Azure:SubscriptionId "<your subscription id>"
aspire secret set Azure:ResourceGroupPrefix "<prefix for the resource group>"
aspire secret set Azure:Location "<azure location>"

NOTE: Developers must have Owner access to the target subscription so that role assignments can be configured for the provisioned resources.

Usage examples

Adding a Key Vault resource to the AppHost model

Add a Key Vault resource in the AppHost, then reference it from another resource with WithReference.

C#

var builder = DistributedApplication.CreateBuilder(args);

var keyVault = builder.AddAzureKeyVault("mykeyvault");

builder.AddProject<Projects.MyApp>("myapp")
       .WithReference(keyVault);

TypeScript

import { createBuilder } from "./.aspire/modules/aspire.mjs";

const builder = await createBuilder();

const keyVault = await builder.addAzureKeyVault("mykeyvault");

await builder.addNodeApp("myapp", "../my-app", "server.js")
    .withReference(keyVault);

Connection Properties

When you reference Azure Key Vault resources using WithReference, the following connection properties are made available to the consuming project:

Property Name Description
Uri The Key Vault endpoint URI, typically https://<vault-name>.vault.azure.net/

Aspire exposes each property as an environment variable named [RESOURCE]_[PROPERTY]. For instance, the Uri property of a resource called db1 becomes DB1_URI.

Customizing the Azure Key Vault resource

The builder.AddAzureKeyVault(...) extension method has an overload that allows for customization of the Key Vault resource that is created. In the below example an Aspire parameter is defined which is then assigned to the value of a Key Vault secret which is created at provisioning time.

var builder = DistributedApplication.CreateBuilder(args);
builder.AddAzureProvisioning();

var webhookSigningSharedSecret = builder.AddParameter("webhooksecret", secret: true);

var keyVault = builder.AddAzureKeyVault("mykeyvault", (_, construct, kv) => {

  // Create a secret and assign an parameter resource to its value.
  var secret = new KeyVaultSecret(construct, "secret");
  secret.AssignProperty(x => x.Properties.Value, webhookSigningSharedSecret);

});

builder.AddProject<Projects.MyApp>("myapp")
       .WithReference(keyVault);

Additional documentation

https://aspire.dev/integrations/gallery/ https://aspire.dev/integrations/cloud/azure/azure-key-vault/azure-key-vault-host/

Feedback & contributing

https://github.com/microsoft/aspire

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 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.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on Aspire.Hosting.Azure.KeyVault:

Package Downloads
Aspire.Hosting.Azure.CosmosDB

Azure Cosmos DB resource types for Aspire.

Aspire.Hosting.Azure.PostgreSQL

Azure PostgreSql Flexible Server resource types for Aspire.

Aspire.Hosting.Azure.Redis

Azure Redis resource types for Aspire.

AzureKeyVaultEmulator.Aspire.Hosting

.NET Aspire AppHost support for the Azure KeyVault Emulator

EAVFramework.Extensions.Aspire.Hosting

Aspire Hosting package for EAVFramework

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Aspire.Hosting.Azure.KeyVault:

Repository Stars
james-gould/azure-keyvault-emulator
An emulator for Azure Key Vault. Compatible with the Azure Client SDK, runnable with Docker or Aspire.
PacktPublishing/Pragmatic-Microservices-with-CSharp-and-Azure
Pragmatic Microservices with C# and Azure, published by Packt
Version Downloads Last Updated
13.5.2 1,706 8/21/2026
13.5.1 3,639 8/20/2026
13.5.0 7,467 8/18/2026
13.4.6 357,415 6/19/2026
13.4.5 33,656 6/17/2026
13.4.4 30,176 6/15/2026
13.4.3 53,757 6/8/2026
13.4.2 96,427 6/3/2026
13.4.1 985 6/3/2026
13.4.0 46,024 6/1/2026
13.3.5 104,697 5/21/2026
13.3.4 19,282 5/19/2026
13.3.3 27,443 5/15/2026
13.3.2 19,804 5/14/2026
13.3.1 13,014 5/12/2026
13.3.0 70,807 5/7/2026
13.2.4 95,553 4/24/2026
13.2.3 34,803 4/21/2026
13.2.2 118,485 4/8/2026
13.2.1 50,474 3/31/2026
Loading failed