Azure.Extensions.AspNetCore.Configuration.Secrets
1.3.2
Prefix Reserved
dotnet add package Azure.Extensions.AspNetCore.Configuration.Secrets --version 1.3.2
NuGet\Install-Package Azure.Extensions.AspNetCore.Configuration.Secrets -Version 1.3.2
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.2" />
paket add Azure.Extensions.AspNetCore.Configuration.Secrets --version 1.3.2
#r "nuget: Azure.Extensions.AspNetCore.Configuration.Secrets, 1.3.2"
// Install Azure.Extensions.AspNetCore.Configuration.Secrets as a Cake Addin #addin nuget:?package=Azure.Extensions.AspNetCore.Configuration.Secrets&version=1.3.2 // Install Azure.Extensions.AspNetCore.Configuration.Secrets as a Cake Tool #tool nuget:?package=Azure.Extensions.AspNetCore.Configuration.Secrets&version=1.3.2
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 Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Azure.Core (>= 1.42.0)
- Azure.Security.KeyVault.Secrets (>= 4.6.0)
- Microsoft.Extensions.Configuration (>= 2.1.0)
NuGet packages (78)
Showing the top 5 NuGet packages that depend on Azure.Extensions.AspNetCore.Configuration.Secrets:
Package | Downloads |
---|---|
Altinn.App.Api
This class library holds all the API controllers used by a standard Altinn 3 App. |
|
Beef.Events
Business Entity Execution Framework (Beef) Events framework. |
|
Energinet.DataHub.Core.FunctionApp.TestCommon
[Release Notes](https://github.com/Energinet-DataHub/geh-core/blob/master/source/TestCommon/documents/release-notes/release-notes.md) [Documentation](https://github.com/Energinet-DataHub/geh-core/blob/master/source/TestCommon/documents/documentation.md) |
|
Beef.AspNetCore.WebApi
Business Entity Execution Framework (Beef) ASP.NET Core Web API extensions. |
|
Jeebs.Apps
Jeebs.Apps library |
GitHub repositories (23)
Showing the top 5 popular GitHub repositories that depend on Azure.Extensions.AspNetCore.Configuration.Secrets:
Repository | Stars |
---|---|
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
|
|
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
|
|
dotnet-architecture/eShopOnWeb
Sample ASP.NET Core 8.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
|
|
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.
|
|
dotnet/aspire
Tools, templates, and packages to accelerate building observable, production-ready apps
|