Azure Logic Apps FTP file transfer
In today’s digital world, it’s common for organizations to need to automate tasks that involve transferring files between different systems. One way to accomplish this is by using Azure Logic Apps FTP file transfer. In this tutorial, we will walk through how to set up a Logic App that will regularly poll an FTP server for new or updated files, and take a specific action when one is detected.
First, let’s start by setting up an FTP connection in Azure Logic Apps. This will allow us to connect to the FTP server and access its file system. From within your Logic Apps Designer search for a trigger task called “FTP”, and add it to your workflow. You will then be prompted to configure the FTP trigger.
Configuring the FTP Trigger
Connection
Parameters
To do this, you will need to specify the folder path to poll on. In this example, we will be using the root folder of the FTP user home directory. You can also specify the polling Time, which determines how frequently the Logic App will check the FTP server for new or updated files. In this case, we have set the polling Time to check every 15 seconds.
from the above image I have configured the following:
Folder Path: ‘./’
Polling Time: Check every 15 seconds
Settings
Next, we will configure some settings for the FTP trigger. In this example, we have added a trigger condition that specifies that the trigger should only fire when a file with the name ‘LogicAppsTest.txt’ has been added or updated in the root of the folder path. To achieve this, we are using the expression @contains(triggerBody()?['Name'], 'LogicAppsTest.txt')
.
1 |
@contains(triggerBody()?['Name'], 'LogicAppsTest.txt') |
the following Microsoft article helps with this: https://techcommunity.microsoft.com/t5/integrations-on-azure-blog/what-you-need-to-know-about-trigger-conditions/ba-p/2320757
the image below shows the final view.
Getting the File Content Action
Once the FTP trigger is configured, we can proceed to add the next action in our workflow. To create a new file with the contents of the file persisted, we will need to add the “Get file content” action. In the parameters section, specify the file path of the file you want to get the content from.
I have shown this in the below image.
Creating the New File Action
Next, we will add the “Create file” action, which will create a new file in a specified location with the contents we retrieved from the previous action. In the parameters section, specify the location where you want to create the new file, and select the content from the “Get file content” action as the input for the new file.
Completed Workflow
Your completed workflow should now look like the following:
With this Logic App in place, it will regularly poll the FTP server for new or updated files, and when it detects a file with the name ‘LogicAppsTest.txt’ in the root folder, it will retrieve the file content and create a new file with that content in the specified location. This can be a useful way to automate file transfer tasks and save time and effort.