Is that possible to read values from appsettings.json before configuration.build ?
i need to get endpoint, clientId, secret and tenant to bind configuration with azure app configuration
Configuration = builder.AddAzureAppConfiguration(options =>
{
//here i need to get some values from appsettings.json
}).Build()
It's not possible.
Here are two examples of a scenario similar to yours in the Azure App Configuration GitHub examples:
https://github.com/Azure/AppConfiguration-DotnetProvider/blob/e227b0b454370751c2ddbebb143fd6e02a07c47b/examples/ConsoleApplication/Program.cs#L36
The example shows that the ConfigurationBuilder is built to obtain an intermediate IConfiguration that is then used to provide a connection string for adding Azure App Configuration to the builder.
https://github.com/Azure/AppConfiguration-DotnetProvider/blob/e227b0b454370751c2ddbebb143fd6e02a07c47b/examples/ConfigStoreDemo/Program.cs#L26
In the ASP.NET Core web application example the same pattern is used with the framework provided IConfigurationBuilder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With