I have used AddMicrosoftIdentityWebApp in my program.cs class for Microsoft Authentication.
builder.Services.AddAuthentication(opts =>
{
opts.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
opts.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddMicrosoftIdentityWebApp(opts =>
{
var azureOptions = builder.Services.BuildServiceProvider().GetRequiredService<IOptionsMonitor<AzureAppOptions>>().CurrentValue;
opts.Instance = azureOptions.Instance;
opts.TenantId = azureOptions.TenantId;
opts.ClientId = azureOptions.ClientId;
opts.CallbackPath = azureOptions.CallbackPath;
}, openIdConnectScheme: OpenIdConnectDefaults.AuthenticationScheme);
If I have to update Azure App details then, I have to restart my application because AddMicrosoftIdentityWebApp only runs at start up.
Is it possible to modify AddMicrosoftIdentityWebApp so that it start using new app details without restarting the application.