Azure Function : Release pipeline to include appsettings.json values

Newbie Dev 151 Reputation points
2022-04-21T12:38:23.113+00:00

I have 2 settings file in my Azure Functions Project.

1) local.settings.json
2) appsettings.json

In the Startup.cs I am combining both into a single Configuration and everything works fine in the code with local debugging.

The Appsetings.json contains nested values. eg:

{
"Test":
  {
   "abc":"def"
  }
}

I am deploying my code to a function App using the Release pipeline in Azure DevOps.

I am using "Azure App Service Settings" task in my release pipeline to substitute the values in the final deployment to the Function App.

So the values that go in the Release task mentioned above is,

[
{ "name": "FUNCTIONS_WORKER_RUNTIME", "value": "dotnet", "slotSetting": false },//from local.settings.json
{ "name": "Test__abc", "value": "def", "slotSetting": false },//from appsettings.json
]

ISSUE:

The code get deployed without any issue and the local.setting.json value is passing through fine. But the issue is with the appsettings.json value. This is getting added to the Configuration tab in Azure Portal, but it does not seem to be used by the app. The app is erroring out because that value is null.

How do I pass the appsetting value through the release task to Azure Functio?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,207 questions
{count} votes