0

I have a new dotnet 7 azure function app that I'd like to run in isolated mode with an Azure DevOps pipeline.

I can run the function locally on azurite no problem because I have a local.settings.json with: "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"

Also, the function will run fine in Azure because the function app has the same as an Application Setting.

The problem comes when trying to run the function in a DevOps pipeline with the "func start" command. Because there is no local.settings.json (this is git-ignored to reduce chance of committing a file containing secrets) the pipeline throws the error:

Did not find functions with language [dotnet]

I would have hoped it would be possible to pass a param to func start to inform to run as dotnet-isolated but it seems the only close match is --dotnet-isolated-debug which is no good for my scenario: https://learn.microsoft.com/en-us/azure/azure-functions/functions-core-tools-reference?tabs=v2#func-start

Rob Bowman
  • 7,632
  • 22
  • 93
  • 200
  • In the Azure Portal Function App Configuration Menu > Application Settings - Make `FUNCTIONS_WORKER_RUNTIME` as `dotnet-isolated` and check. –  Jan 18 '23 at 03:12
  • Thanks Hari but I think I covered this in the question: "Also, the function will run fine in Azure because the function app has the same as an Application Setting" – Rob Bowman Jan 19 '23 at 07:42
  • One more Check Rob, Can you check this SO Thread [54606696](https://stackoverflow.com/a/54606875/16630138) where we have to transform the configuration settings present in `local.settings.json`. Could you check the same setting `FUNCTIONS_WORKER_RUNTIME` as `dotnet-isolated` in Pipeline Configuration settings as shown in given SO Link. –  Jan 19 '23 at 11:21

1 Answers1

0

Can be solved by creating a local.settings.json to run in the pipeline:

if (-not (Test-Path local.settings.json))
{
  Write-Host "Creating default local.settings.json"
  $json = '{"IsEncrypted": false,"Values": {"AzureWebJobsStorage": "UseDevelopmentStorage=true", "FUNCTIONS_WORKER_RUNTIME": "dotnet"}}'
  Set-Content -Path local.settings.json -Value $json
}

Details can be seen at this blog post

Rob Bowman
  • 7,632
  • 22
  • 93
  • 200