Write data to a csv file using azure function and then upload to sftp location

suvra jyoti 156 Reputation points
2021-06-02T11:24:39.457+00:00

Hi All,

I have created a Time Triggered Azure Function that runs on a schedule. I am fetching data for API Usage(i am using Azure APIM) using the Azure Rest APIs and want to put it in a csv file. Once the csv file is ready i need to upload it to a SFTP location.

Any pointers on this will be helpful.

Thanks,
SuvraJyoti.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,929 questions
0 comments No comments
{count} votes

Accepted answer
  1. MikeUrnun 9,777 Reputation points Moderator
    2021-06-02T21:04:00.847+00:00

    Hi @suvra jyoti - You can build this very quickly using Logic Apps which provides designer-first services, and it has a concept of plug-and-play Connectors that you can use to go up & running with your scenario:

    1. Recurrence trigger (equivalent to TimeTrigger)
    2. HTTP Connector for calling your APIM endpoint and fetching data.
    3. Perform data operations for the CSV-related data parsing & transformations.
    4. SFTP Connector for moving the CSV file to a remote SFTP server.

    I suggest Logic Apps here because it's designed to run long-running workflows and can integrate disparate systems (i.e.: APIM, SFTP etc..).

    That said, you can certainly use Azure Functions App and build the above in a code-first way as well, in which case, if it were me, I would look to create two Functions in my app where the first one implements steps #1 and #2 above, and the second Function implements steps #3 and #4.


1 additional answer

Sort by: Most helpful
  1. sadomovalex 3,636 Reputation points
    2021-06-03T15:07:49.97+00:00

    which programming language you use for AF? If you use C# you may build csv file in memory first and then save it to SFTP e.g. like shown here: SFTP File Upload With C# Application.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.