Location for SSH private key and temporary SFTP download data in Azure functions

Viewed 701

I am writing an Azure function that uses WinSCP library to download files using SFTP and upload the files on blob storage. This library doesn't allow to get files as a Stream. Only option is to download them locally. My code also uses a private key file. So i have 2 questions.

  1. sessionOptions.SshPrivateKeyPath = Path.GetFullPath("privateKey2.ppk"); is working locally. I have added this file in solution with option "copy to output" and it works. But will it work when Azure function is deployed?
    enter image description here

  2. While getting the files I need to specify local path where the files will be downloaded.

    var transferResult = session.GetFiles(
        file.FullName, Path.GetTempPath() + @"SomeFolder\" + file.Name, false,
        transferOptions); 
    

    The second parameter is the local path.

    What should I use in place of Path.GetTempPath() that will work when Azure function is deployed?

1 Answers
Related