Can we trigger the function app when the file is u

2019-08-26 07:11发布

问题:

Can we trigger the function app when the file is uploaded into the sftp. I have checked the Integrate--> trigger--> External file. We have an option SFTP and I have created the sftp connection over there. But my function is not getting triggered when the file is uploaded into the sftp. Could you please help me on this ?

using System;

public static string Run(string inputFile, string name, TraceWriter log)
{
log.Info($"C# External trigger function processed file: " + name);
return inputFile;
}

Binding

{
"bindings": [
{
  "type": "apiHubFileTrigger",
  "name": "inputFile",
  "direction": "in",
  "path": "sample/{name}",
  "connection": "sftp_SFTP"
}

],
"disabled": false
}

Thanks

回答1:

If we create External file trigger, we could know that External file trigger is still Preview trigger.

If Logic App is possible, I recommand that you could use Logic App instead of Azure functon External file trigger currently.

Based on my test, the trigger doesn't work with default template. Sometimes it works for me with following way.

Note: The following ways just sometimes works for me.

After create SFTP connection, we could get the SFTP API connection in the resource group. For more information you could refer to the screenshot.

1.Edit the SFTP connection API(add the password)

2.Debug with Azure portal. Maybe get the error info Binding data does not contain expected value 'name'.

3.Change the bind name to other and change it back again.

4.Upload a new file to SFTP path and it will be triggered