DotNetCore.Azure.Configuration.KvSecrets 6.0.1

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
Install-Package DotNetCore.Azure.Configuration.KvSecrets -Version 6.0.1
dotnet add package DotNetCore.Azure.Configuration.KvSecrets --version 6.0.1
<PackageReference Include="DotNetCore.Azure.Configuration.KvSecrets" Version="6.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetCore.Azure.Configuration.KvSecrets --version 6.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DotNetCore.Azure.Configuration.KvSecrets, 6.0.1"
#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 DotNetCore.Azure.Configuration.KvSecrets as a Cake Addin
#addin nuget:?package=DotNetCore.Azure.Configuration.KvSecrets&version=6.0.1

// Install DotNetCore.Azure.Configuration.KvSecrets as a Cake Tool
#tool nuget:?package=DotNetCore.Azure.Configuration.KvSecrets&version=6.0.1
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 AspNetCore.Azure.Configuration.KvSecrets based on Azure.Extensions.AspNetCore.Configuration.Secrets which package allows storing configuration values using Azure Key Vault Secrets.


  • Allows to load secrets by list and map them into new names.
  • Allows to load secrets into the configuration section.

Getting started

Install the package

Install the package with DotNetCore.Azure.Configuration.KvSecrets:

Version 6.x.x : supports only Microsoft.AspNetCore.App 6.0-*

Version 5.x.x : supports only Microsoft.AspNetCore.App 5.0-*

Version 3.1.x : supports only Microsoft.AspNetCore.App 3.1.0-*

    dotnet add package DotNetCore.Azure.Configuration.KvSecrets


You need an Azure subscription and [Azure Key Vault][keyvault_doc] 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"


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


    public static IHostBuilder CreateHostBuilder(string[] args) =>
                .ConfigureWebHostDefaults(webBuilder =>


        public static void AddKvConfigurations(WebHostBuilderContext hostingContext, IConfigurationBuilder configurationBuilder)
            var configBuilder = new ConfigurationBuilder().AddInMemoryCollection();
            IHostEnvironment env = hostingContext.HostingEnvironment;
            configBuilder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
                  .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);

            var config = configBuilder.Build();

            string KeyVaultUrl = config[nameof(KeyVaultUrl)];
            List<string> VaultSecrets = config.GetSection(nameof(UploadKeyList)).Get<List<string>>();
            string ConfigurationSectionPrefix = config[nameof(ConfigurationSectionPrefix)];

            var credential = new AzureCliCredential();
            //var credential = new DefaultAzureCredential();
            var client = new SecretClient(vaultUri: new Uri(KeyVaultUrl), credential);
            var options = new AzureKvConfigurationOptions()
                ConfigurationSectionPrefix = ConfigurationSectionPrefix,
                UploadKeyList = UploadKeyList

            configurationBuilder.AddAzureKeyVault(client, options);


  "ConfigurationSectionPrefix": "secret",
  "KeyVaultUrl": "",
  "VaultSecrets": [ "FuseEval--Demo8", "LoadInMess", "RealSecretForVault" ]

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

Next steps

Read more about configuration in ASP.NET Core.


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

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


NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.0.2 69 12/4/2021
6.0.0 109 11/16/2021
5.0.0 146 2/7/2021
3.1.0 276 3/11/2021

Only supports the .net 6.0.