Search code examples
c#azureazure-functions

Azure Functions - using appsettings.json


Is it possible to use an appsettings.json file in Azure Functions?

There is documentation for environment variables here..

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp#environment-variables

..however we use Octopus for deployments and would really like to have appsettings version controlled.

We have tried using

{
  "frameworks": {
    "net46": {
      "dependencies": {
        "Microsoft.Extensions.Configuration": "1.0.0",
        "Microsoft.Extensions.Configuration.Json": "1.0.0"
      }
    }
  }
}

but constantly get

2016-11-23T15:27:03.811 (12,16): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0

Even being able to supply/update environment variables via Octopus would be sufficient for our needs.

Please advise.


Solution

  • Only environment variables are supported for app settings and connection strings. appsettings.json is not supported.

    However, you can use Azure Resource Manager (ARM) Templates to configure the settings for your Function App. Here's a blog post that describe this in more detail.