Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read values from appsettings.json before configuration.build

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()
like image 313
kosnkov Avatar asked Apr 26 '26 15:04

kosnkov


1 Answers

It's not possible.

Here are two examples of a scenario similar to yours in the Azure App Configuration GitHub examples:

Console Application

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.

ASP.NET Core Web Application

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

like image 198
J. Campbell Avatar answered Apr 29 '26 04:04

J. Campbell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!