Home > front end >  Azure functions sending a file to sftp server
Azure functions sending a file to sftp server

Time:10-19

I came across https://github.com/sshnet/SSH.NET library for connecting with sftp server, however It says its only compatible with .net framework while we use .net core for writing azure functions. Does anyone know any other way? Also how do I send the file to the server once I am connected to the server.

CodePudding user response:

Have used Renci.SshNet with Azure Functions successfully.

Upload is as simple as:

var connectionInfo = new ConnectionInfo(
      config["SftpHostname"], 
      username, 
      new PasswordAuthenticationMethod(username, config["SftpPassword"]
    ));
sftpClient = new SftpClient(connectionInfo);
sftpClient.Connect();
sftpClient.UploadFile(requestFile, filePath);
  • Related