Skip to content

Instantly share code, notes, and snippets.

@maxnorth maxnorth/Program.cs

Last active Jan 22, 2020
What would you like to do?
Using environment type to optionally enable key vault provider
using System;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.AzureKeyVault;
namespace Example
public class Program
public static void Main(string[] args)
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
.ConfigureAppConfiguration((context, configBuilder) =>
var env = context.HostingEnvironment.EnvironmentName.ToLowerInvariant();
if (env != "development")
var config = configBuilder.Build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.