Friday, 4 August 2017

Precompiled Azure Functions not appearing when published

I had an Pre-compiled Azure Function that when published, would not appear in the list of functions.
The function.json looked like this:

{
  "disabled": false,
  "scriptFile": "PdfGeneration.dll",
  "entryPoint": "PdfGeneration.EntryPoint.Run",
  "bindings": [
    {
      "authLevel": "anonymous",
      "name": "req",
      "type": "httpTrigger",
      "direction": "in"
    },
    {
      "name": "res",
      "type": "http",
      "direction": "out"
    }
  ]
}

After a while I found the problem. Publishing the precompiled function does not also publish the assembly.
You need to manually copy it to the appropriate folder on the Web App that hosts the Azure Function.

If you put the assembly in the correct place and redeploy, the function appears.


Open Kudu for the app:
https://<FunctionApp>.scm.azurewebsites.net/DebugConsole

Navigate to the folder for the function:
/site/wwwroot/<functionname>

drag and drop the assemblies into the folder.

Note the scriptFile property is relative to the function folder. If you want to put the assemblies in a bin folder off the function folder, you must use:
  "scriptFile": "bin\\PdfGeneration.dll",


No comments:

Post a comment