0

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.

azureLover
  • 65
  • 1
  • 6
  • Will suggest you to edit the question please. Do you want to write an azure function for sending a file to another server using SSH? https://codeburst.io/working-with-sftp-in-net-core-f1f464ab06f8 This article should help. – Ziaullah Khan Oct 15 '21 at 18:27
  • https://stackoverflow.com/a/51667778/1384539 – Thiago Custodio Oct 15 '21 at 22:22
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Oct 16 '21 at 18:09

1 Answers1

1

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);
Adam Vincent
  • 3,281
  • 14
  • 38
  • Thanks for answering! but did you ever face this issue : Renci.SshNet: An attempt was made to access a socket in a way forbidden by its access permissions. – azureLover Oct 19 '21 at 14:01
  • Not that I know of. I didn't impl it myself. Is this a UWP application? – Adam Vincent Oct 19 '21 at 17:23