Workleap.Extensions.Configuration.Secrets
1.0.5-preview.22
Prefix Reserved
See the version list below for details.
dotnet add package Workleap.Extensions.Configuration.Secrets --version 1.0.5-preview.22
NuGet\Install-Package Workleap.Extensions.Configuration.Secrets -Version 1.0.5-preview.22
<PackageReference Include="Workleap.Extensions.Configuration.Secrets" Version="1.0.5-preview.22" />
paket add Workleap.Extensions.Configuration.Secrets --version 1.0.5-preview.22
#r "nuget: Workleap.Extensions.Configuration.Secrets, 1.0.5-preview.22"
// Install Workleap.Extensions.Configuration.Secrets as a Cake Addin #addin nuget:?package=Workleap.Extensions.Configuration.Secrets&version=1.0.5-preview.22&prerelease // Install Workleap.Extensions.Configuration.Secrets as a Cake Tool #tool nuget:?package=Workleap.Extensions.Configuration.Secrets&version=1.0.5-preview.22&prerelease
Workleap.Extensions.Configuration.Secrets
This package allows storing configuration values in Azure Key Vault Secrets, using the right Azure credentials based on the current environment.
It can also be used to register ITokenCredentialProvider
and ISecretClientProvider
in IServiceCollection
in order to access Azure credentials or a SecretClient
instance.
Getting started
dotnet add package Workleap.Extensions.Configuration.Secrets
Example with an ASP.NET Core minimal API:
var builder = WebApplication.CreateBuilder();
// There are three ways to load configuration values from Azure Key Vault:
builder.Configuration.AddKeyVaultSecrets(builder.Environment);
builder.Configuration.AddKeyVaultSecrets(builder.Environment, new Uri("<my-key-vault-url>"));
builder.Configuration.AddKeyVaultSecrets(builder.Environment, "<my-configuration-key>");
// Register ITokenCredentialProvider and ISecretClientProvider services (optional)
builder.Services.AddKeyVaultSecrets();
Using the registered services
ITokenCredentialProvider
and its public implementation TokenCredentialProvider
provides an instance of TokenCredential
based on the current environment:
ManagedIdentityCredential
on a non-development environment,- Chained credentials of
AzureCliCredential
andManagedIdentityCredential
in development environment, or CachedInteractiveBrowserCredential
in development environment only when Fiddler is opened (Fiddler interferes withaz login
authentication).
var azureCredential = new TokenCredentialProvider(environment).GetTokenCredential(); // or
var azureCredential = services.GetRequiredService<ITokenCredentialProvider>().GetTokenCredential();
ISecretClientProvider
and its public implementation SecretClientProvider
provides an instance of SecretClient
based on the current environment:
var secretClientProvider = new SecretClientProvider(configurationBuilder, environment); // or
var secretClientProvider = new SecretClientProvider(configuration, environment); // or
var secretClientProvider = services.GetRequiredService<ISecretClientProvider>();
var secretClient = secretClientProvider.GetSecretClient(keyVaultKind); // or
var secretClient = secretClientProvider.GetSecretClient(keyVaultUri); // or
var secretClient = secretClientProvider.GetSecretClient(configurationKey);
License
Copyright © 2022, Workleap. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/gsoft-inc/gsoft-license/blob/master/LICENSE.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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.Extensions.AspNetCore.Configuration.Secrets (>= 1.3.2)
- Azure.Identity (>= 1.13.1)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
-
net6.0
- Azure.Extensions.AspNetCore.Configuration.Secrets (>= 1.3.2)
- Azure.Identity (>= 1.13.1)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.