Missing value for AzureWebJobsStorage in local.settings.json local development in Visual Studio 2017

I was getting the same error when I was running my Azure Function in my Visual Studio 2019.

enter image description here

I had already set the Copy To Output Directory action to Copy always and I was still getting the same error. The issue is that the Azure Function local.settings.json file doesn't support nested json. You can track this issue here.

I was having values in local.settings.json as preceding.

{
  "IsEncrypted": false,
  "Values": {
    "Custom": {
      "Tickets": {
        "Channels": [
          "One",
          "Two"
        ]
      }
    },
    "AzureWebJobsStorage": "",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "ServiceBusConnectionString": ""
  }
}

As you can see that there is an extra nested json (Custom) object inside Values, that is the reason why I was getting this error. To fix this, I had to add a new configuration file called configuration.json and add my custom values there.

"Custom": {
      "Tickets": {
        "Channels": [
          "One",
          "Two"
        ]
      }
    }

The fix is to use either the ConfigurationBuilder or read that file using File.ReadAllText. You can also add the entire JSON as a plain string in the local.settings.json instead of a JSON object.

Hope it helps.


The solution was to right-click on local.settings.json, go to properties, change "Copy to Output directory" from "Do not copy" to "Copy always". Now the CLI picks up the settings when running from within Visual Studio 2017.

https://github.com/Azure/azure-functions-core-tools/issues/223#issuecomment-326225219


FYI, you also get this error when the value for "AzureWebJobsStorage" is effectively empty (""). You can set it to e.g. "UseDevelopmentStorage=true" for development.