Created
June 11, 2018 22:35
-
-
Save MisinformedDNA/6cd6117389792d91d1862f8954d4afd8 to your computer and use it in GitHub Desktop.
ASP.NET Core with Azure Key Vault configuration provider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Configuration; | |
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => | |
WebHost.CreateDefaultBuilder(args) | |
.ConfigureAppConfiguration((context, config) => | |
{ | |
var builtConfig = config.Build(); | |
var keyVaultConfigBuilder = new ConfigurationBuilder(); | |
keyVaultConfigBuilder.AddAzureKeyVault( | |
$"https://{builtConfig["Vault"]}.vault.azure.net/", | |
builtConfig["ClientId"], | |
builtConfig["ClientSecret"]); | |
var keyVaultConfig = keyVaultConfigBuilder.Build(); | |
config.AddConfiguration(keyVaultConfig); | |
}) | |
.UseStartup<Startup>(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment