Azure.Extensions.AspNetCore.Configuration.Secrets 1.2.2 The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved

.NET Standard 2.0
Install-Package Azure.Extensions.AspNetCore.Configuration.Secrets -Version 1.2.2
dotnet add package Azure.Extensions.AspNetCore.Configuration.Secrets --version 1.2.2
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Azure.Extensions.AspNetCore.Configuration.Secrets --version 1.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Azure.Extensions.AspNetCore.Configuration.Secrets, 1.2.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Azure.Extensions.AspNetCore.Configuration.Secrets as a Cake Addin
#addin nuget:?package=Azure.Extensions.AspNetCore.Configuration.Secrets&version=1.2.2

// Install Azure.Extensions.AspNetCore.Configuration.Secrets as a Cake Tool
#tool nuget:?package=Azure.Extensions.AspNetCore.Configuration.Secrets&version=1.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Azure Key Vault Secrets configuration provider for Microsoft.Extensions.Configuration

The Azure.Extensions.AspNetCore.Configuration.Secrets package allows storing configuration values using Azure Key Vault Secrets.

Getting started

Install the package

Install the package with NuGet:

dotnet add package Azure.Extensions.AspNetCore.Configuration.Secrets

Prerequisites

You need an Azure subscription and Azure Key Vault to use this package.

To create a new Key Vault, you can use the Azure Portal, Azure PowerShell, or the Azure CLI. Here's an example using the Azure CLI:

az keyvault create --name MyVault --resource-group MyResourceGroup --location westus
az keyvault secret set --vault-name MyVault --name MySecret --value "hVFkk965BuUv"
Azure role-based access control

When using azure role-based access control, the identity you are authenticating has to have the "Key Vault Reader" and "Key Vault Secrets User" roles. The "Key Vault Reader" role allows the extension to list secrets while the "Key Vault Secrets User" allows retrieving their values.

az role assignment create --role "Key Vault Reader" --assignee {i.e user@microsoft.com} --scope /subscriptions/{subscriptionid}/resourcegroups/{resource-group-name}
az role assignment create --role "Key Vault Secrets User" --assignee {i.e user@microsoft.com} --scope /subscriptions/{subscriptionid}/resourcegroups/{resource-group-name}

Key concepts

Thread safety

We guarantee that all client instance methods are thread-safe and independent of each other (guideline). This ensures that the recommendation of reusing client instances is always safe, even across threads.

Additional concepts

Client options | Accessing the response | Long-running operations | Handling failures | Diagnostics | Mocking | Client lifetime

Examples

To load initialize configuration from Azure Key Vault secrets call the AddAzureKeyVault on ConfigurationBuilder:

ConfigurationBuilder builder = new ConfigurationBuilder();
builder.AddAzureKeyVault(new Uri("<Vault URI>"), new DefaultAzureCredential());

IConfiguration configuration = builder.Build();
Console.WriteLine(configuration["MySecret"]);

The Azure Identity library provides easy Azure Active Directory support for authentication.

Next steps

Read more about configuration in ASP.NET Core.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit cla.microsoft.com.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (28)

Showing the top 5 NuGet packages that depend on Azure.Extensions.AspNetCore.Configuration.Secrets:

Package Downloads
CDT.Cosmos.Cms.Common

This package contains all the common methods and objects used by the Cosmos CMS editor website, and by any website service the role of a publishing website.

Beef.Events

Business Entity Execution Framework (Beef) Events framework.

Beef.Test.NUnit

Business Entity Execution Framework (Beef) NUnit extensions used for testing.

Jeebs.Apps

Jeebs.Apps library

Beef.AspNetCore.WebApi

Business Entity Execution Framework (Beef) ASP.NET Core Web API extensions.

GitHub repositories (12)

Showing the top 5 popular GitHub repositories that depend on Azure.Extensions.AspNetCore.Configuration.Secrets:

Repository Stars
dotnet-architecture/eShopOnContainers
Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 6, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor.
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
OrchardCMS/OrchardCore
Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
phongnguyend/Practical.CleanArchitecture
Asp.Net Core 6 Clean Architecture (Microservices, Modular Monolith, Monolith) samples (+Blazor, Angular 13, React 17, Vue 2.6), Domain-Driven Design, CQRS, Event Sourcing, SOLID, Asp.Net Core Identity Custom Storage, Identity Server 4 Admin UI, Entity Framework Core, Selenium E2E Testing, SignalR, Hosted Services, Health Checks, Security Headers, ...
microsoft/fhir-server
A service that implements the FHIR standard
Version Downloads Last updated
1.2.2 760,302 4/6/2022
1.2.1 4,679,356 5/18/2021
1.1.0 61,501 5/14/2021
1.0.2 2,489,362 11/6/2020
1.0.1 113,039 10/2/2020
1.0.0 365,236 6/5/2020
1.0.0-preview.2 473 5/5/2020