I have an Azure Functions project, which I am writing in C# using Visual Studio 2017 15.3 preview 7. The functions project contains two seperate functions, both of which are timer triggered. I have a number of appsettings which I have specified in an appsettings.json file, which is set to Copy to the output directory on build.
When I publish the Azure Functions project, the two functions are displayed in the Azure portal, however they fail as they do not have access to the app settings. Now I know I can specifiy the settings in the application settings blade, but I want to use appsettings.json which should be possible according to this github issue: https://github.com/Azure/azure-functions-cli/issues/33
This SO answer contains some information about getting it to work Azure Functions - using appsettings.json. Now the issue lies in "Azure will try looking for after appsettings.json file into your root folder of the Function that you working on." My function project as it stands contains the following file structure:
-appsettings.json
-Function_function1.cs
-Function_function2.cs
-host.json
When the project is built and deployed, I end up with a folder for each of the functions in the wwwroot, each of these contains a function.json file. The appsettings.json file goes into the wwwroot/bin folder and the functions are not able to access it.
I thought that maybe if I changed functions project to have a folder structure it would deploy the appsettings.json, I changed it to the following
-host.json
-Function_function1\
--Function_function1.cs
--appsettings.json
-Function_function2\
--Function_function2.cs
--appsettings.json
This didn't have the result I expected and at this point I am not quite sure what I need to do to get appsettings copied into the function folders under the wwwroot rather than the bin folder, any guidance will be appreciated.