You can add your values to your appsettings.json file like so or store them as Application Settings under App Service | Configuration > General Settings and access them with the following code in your StartUp.cs
public IConfiguration Configuration { get; }
....
var aad = Configuration.GetSection("AzureAd");
You don't necessarily need Azure.Identity if all you're doing is pulling the values from within the app. If you're using something like App Config or Key Vault, then you'll need that API to utilize DefaultAzureCredential()
and get the values.
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
webBuilder.ConfigureAppConfiguration((hostingContext, config) =>
{
configuration = config.Build();
var credentials = new DefaultAzureCredential();
config.AddAzureAppConfiguration(options =>
{
options.Connect(new Uri(configuration["AppConfigEndpoint"]), credentials);
});
}).UseStartup<Startup>());