azure-functions-core-tools icon indicating copy to clipboard operation
azure-functions-core-tools copied to clipboard

[Function Core Tools] --dotnetIsolated doesn't exist as a worker runtime option to publish from function core tools

Open Justrebl opened this issue 7 months ago • 6 comments

Hello,

Context The func azure functionapp publish command has 2 options to define the function worker runtime of the target Function App :

  • setting FUNCTION_WORKER_RUNTIME setting in local.settings.json in a local dev environment
  • Defining the option as a command parameter as --csharp --typescript --custom, etc.

Issue Trying to publish a dotnet isolated function app from a github action isn't an option as we need to specify the FUNCTION_WORKER_RUNTIME to be set in the local.settings.json : There doesn't seem to be any specific func azure functionapp publish option for dotnetisolated (while --csharp will default to .Net in-process runtime, not .Net Isolated).

Repro Steps

  1. Create a fresh dotnet isolated function app from the function core tools
  2. Make sure the proper .gitignore is set (to avoid pushing local.settings.json with the function app code)
  3. Push the function app code to a Github repository
  4. Create a Github Action that will login to Azure
  5. Add a step to run the following command : func azure functionapp publish
  6. Running the Github action should fail at the func publish step with the following error :
Your Azure Function App has 'FUNCTIONS_WORKER_RUNTIME' set to 'dotnet-isolated' while your local project is set to 'None'.
You can pass --force to update your Azure app with 'None' as a 'FUNCTIONS_WORKER_RUNTIME'

Workaround we found Local.settings.json usually isn't versionned, ruling out the option to keep it in the repo next to the function app code.

While creating a github action to deploy the dotnet isolated function app code after IaC completes, we had no other option than copy a local.settings.json.template file (with only the FUNCTION_WORKER_RUNTIME value set to "dotnet-isolated") to a fresh local.settings.json as per github action step so that the dotnet isolated runtime is recognized by the func azure function app publish at run time.

Feel free to route me to an article in case i missed it. Kind regards

Justrebl avatar Nov 17 '23 16:11 Justrebl