Azure Functions - Host.json not applying to Azure Application Settings

Viewed 2263

I'm at a complete loss here. I've just configured a new Azure Function app and created the following host.json file:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingExcludedTypes": "Request",
      "samplingSettings": {
        "isEnabled": true
      }
    }
  },
  "Values": {
    "BaseUrl": "https://test.test.com",
    "GrantType": "test",
    "ClientId": "test",
    "ClientSecret": "1234"
  }
}

For some reason, the settings under "Values" are not applying in the Azure portal. When I view the function settings none of these values show under "Application Settings" and I need to manually add them in order to allow the workflow to run. I've done some research and it seems to suggest that this is the expected outcome? IE: I'm supposed to configure these values on Azure?

I'm using the latest version of Azure Functions on .NET Core 3.1

2 Answers

If you are publishing your app from Visual Studio, then as soon as you click on publish, you will see an option of Manage Application Setting, there you can provide the setting, and it will be saved in your Azure Function Profile. That would be a one time process, until unless you are changing your settings. enter image description here

Another option is that you can Azure Pipelines to deploy your function app, and then you can pass these values as a variable to pipeline

It seems you want to set some settings for your function app.

On local, the settings is stored in local.settings.json. But when you deploy your function app to azure, the local.settings.json will not be upload. And on azure, env variable is taking from the configuration settings instead of local.settings.json.

On portal, if you want to get env variable, you should save them in this place and dont forget to save:

enter image description here

Related