Is there any way to directly upload a azure blob to an sftp server location?

0 votes
asked Aug 3, 2020 by dilip (120 points)

I do have a requirement. Files stored in my azure storage needs to be transferred to SFTP server directly in C#. Now I am getting the stream of the blob first then writting the stream to SFTP location which is causing some memory issues.

1 Answer

0 votes
answered Aug 3, 2020 by Lukas Pokorny (117,910 points)

To transfer an Azure blob via Rebex SFTP client to an SFTP server without the need to keep data of the whole blob in memory, try this approach:

// get blob container client
var container = new BlobContainerClient(connectionString, "...");

// establish Rebex SFTP session
var sftp = new Sftp();

// get block client
var blobClient = container.GetBlobClient("");

// transfer data from the blob to a file on an SFTP server
using (var uploadStream = sftp.GetUploadStream(""))