I am working on azure function app which references another project from core folder and that project contains the below class.
In this I am trying to read appsettings.json file and it works fine locally but when it's deployed to azure portal it could not find this file and builder.Build() method throws FileNotFoundException.
public static class ConfigurationSettings
{
public static IConfigurationRoot GetConfigurationRoot()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json");
return builder.Build();
}
}
Can anyone suggest me what wrong i am doing here and is there any other to include files in azure function apps?
appsettings.jsonfile to load configuration values for your application. Use the proper functionality which is available, like theConfigurationManagerand use Application Settings, which are set either manual or via some deployment tool (like VSTS)