Search code examples
c#azure-functionsglobal-variables

Where to store sharepoint paths in Azure Functions?


I am developing an Azure Function and have a question on where to store variables in the form of paths to sharepoint libaries.

I have several methods that should be able to access these variables, so I guess I am looking for a way to save these like some form of global variable, but is this best practice in OOP such as C#? And in that case, should I use local.settings.json for this or store them somewhere else?


Solution

  • Yes, settings.json is the way to go. When you deploy you can the override these settings in the Configuration -> Application Settings section in the Azure portal (or via Azure CLI).

    Screenshots, CLI examples, and more can be found in the official Manage your function app. It states:

    When you develop a function app locally, you must maintain local copies of these values in the local.settings.json project file. To learn more, see Local settings file.