Skip to content

Instantly share code, notes, and snippets.

@xximjasonxx
Created January 18, 2022 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xximjasonxx/7436121f87e357663c89eb526e8c3cd8 to your computer and use it in GitHub Desktop.
Save xximjasonxx/7436121f87e357663c89eb526e8c3cd8 to your computer and use it in GitHub Desktop.
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureAppConfiguration(config =>
{
config.AddAzureAppConfiguration(appConfig =>
{
var credential = new ManagedIdentityCredential("93e93c24-c457-4dea-bee3-218b29ae32f1");
appConfig.Connect(new Uri(AppConfigUrl), credential)
.ConfigureKeyVault(kvConfig =>
{
kvConfig.SetCredential(credential);
});
});
}).UseStartup<Startup>();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment