Suderson's solution worked for me when modified as below:
var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddEnvironmentVariables(); IConfiguration config = builder.Build(); //Now, You can use config.GetSection(key) to get the config entries