How to read file content from sftp in azure function

%3CLINGO-SUB%20id%3D%22lingo-sub-2543625%22%20slang%3D%22en-US%22%3EHow%20to%20read%20file%20content%20from%20sftp%20in%20azure%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2543625%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20download%20file%20content%20from%20sftp%20and%20it%20works%20in%20windows10%20local%20system%20but%20on%20azure%20portal%20not%20working.%3CBR%20%2F%3EFile.OpenWrite%20throws%20error%20as%20Could%20not%20find%20file.%3C%2FP%3E%3CP%3Eusing%20(Stream%20tempFile%20%3D%20File.OpenWrite(tempFolder%20%2B%20fileName))%3CBR%20%2F%3E%7B%3CBR%20%2F%3Esftp.DownloadFile(fileFullName%2C%20tempFile)%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3EPlease%20suggest.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2544111%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20read%20file%20content%20from%20sftp%20in%20azure%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2544111%22%20slang%3D%22en-US%22%3ECan%20you%20comfirm%20that%20the%20sftp%20path%20tempFolder%20%2B%20fileName%20is%20reachable%20from%20your%20azure%20resource%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2545088%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20read%20file%20content%20from%20sftp%20in%20azure%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2545088%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F816725%22%20target%3D%22_blank%22%3E%40subhankars%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%2C%20I%20am%20able%20to%20reach%20the%20sftp%20folder.%3C%2FP%3E%3CP%3EProblem%20with%20the%20compressed(.zip)%20file.%3C%2FP%3E%3CP%3EI%20want%20read%20the%20content%20from%20compressed%20file%20in%20azure%20function.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I am trying to download file content from sftp and it works in windows10 local system but on azure portal not working.
File.OpenWrite throws error as Could not find file.

using (Stream tempFile = File.OpenWrite(tempFolder + fileName))
{
sftp.DownloadFile(fileFullName, tempFile);
}

Please suggest.

2 Replies
Can you comfirm that the sftp path tempFolder + fileName is reachable from your azure resource?

@subhankars 

Yes, I am able to reach the sftp folder.

Problem with the compressed(.zip) file.

I want read the content from compressed file in azure function.