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
<PackageReference Include="Aspire.Hosting.Azure.KeyVault" Version="13.5.2" />
<PackageVersion Include="Aspire.Hosting.Azure.KeyVault" Version="13.5.2" />
<PackageReference Include="Aspire.Hosting.Azure.KeyVault" />
paket add Aspire.Hosting.Azure.KeyVault --version 13.5.2
#r "nuget: Aspire.Hosting.Azure.KeyVault, 13.5.2"
#:package Aspire.Hosting.Azure.KeyVault@13.5.2
#addin nuget:?package=Aspire.Hosting.Azure.KeyVault&version=13.5.2
#tool nuget:?package=Aspire.Hosting.Azure.KeyVault&version=13.5.2
Azure Key Vault hosting integration
Use this integration to model, configure, and provision Azure Key Vault resources in an Aspire solution.
Getting started
Prerequisites
- Azure subscription - create one for free
- An Aspire project based on the starter template.
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
| 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. |
-
net8.0
- Aspire.Hosting.Azure (>= 13.5.2)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Azure.Core (>= 1.57.0)
- Azure.Identity (>= 1.21.0)
- Azure.Provisioning (>= 1.5.0)
- Azure.Provisioning.KeyVault (>= 1.1.0)
- Azure.ResourceManager.Authorization (>= 1.1.6)
- Azure.ResourceManager.KeyVault (>= 1.4.0)
- Azure.ResourceManager.Resources (>= 1.11.2)
- Azure.Security.KeyVault.Secrets (>= 4.11.0)
- Google.Protobuf (>= 3.34.1)
- Grpc.AspNetCore (>= 2.80.0)
- Grpc.Net.ClientFactory (>= 2.80.0)
- Grpc.Tools (>= 2.80.0)
- Humanizer.Core (>= 3.0.10)
- JsonPatch.Net (>= 5.0.2)
- KubernetesClient (>= 19.0.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.30)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.11)
- Microsoft.Extensions.Hosting (>= 10.0.11)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.Extensions.Logging (>= 10.0.11)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
- Microsoft.Extensions.Primitives (>= 10.0.11)
- ModelContextProtocol (>= 1.3.0)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.15.3)
- OpenTelemetry.Extensions.Hosting (>= 1.15.3)
- Polly.Core (>= 8.6.6)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.25.29)
- System.IO.Hashing (>= 10.0.8)
- System.Text.Json (>= 10.0.11)
- YamlDotNet (>= 16.3.0)
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 |