Use the FTP connector to monitor, manage and create files on an FTP server.
Connect to FTP
Before your logic app can access any service, you first need to create a connection to the service. A connection provides connectivity between a logic app and another service.
Create a connection to FTP
- An FTP account
Before you can use your FTP account in a logic app, you must authorize the logic app to connect to your FTP account.Fortunately, you can do this easily from within your logic app on the Azure Portal.
Here are the steps to authorize your logic app to connect to your FTP account:
- To create a connection to FTP, in the logic app designer, select Show Microsoft managed APIs in the drop down list then enter FTP in the search box. Select the trigger or action you'll like to use:
- If you haven't created any connections to FTP before, you'll get prompted to provide your FTP credentials. These credentials will be used to authorize your logic app to connect to, and access your FTP account's data:
- Notice the connection has been created and you are now free to proceed with the other steps in your logic app:
Use a FTP trigger
A trigger is an event that can be used to start the workflow defined in a logic app. Learn more about triggers.
The FTP connector requires an FTP server that is accessible from the Internet and is configured to operate with PASSIVE mode. Also, the FTP connector is not compatible with implicit FTPS (FTP over SSL). The FTP connector only supports explicit FTPS (FTP over SSL).
In this example, I will show you how to use the FTP - When a file is added or modified trigger to initiate a logic app workflow when a file is added to, or modified on, an FTP server. In an enterprise example, you could use this trigger to monitor an FTP folder for new files that represent orders from customers. You could then use an FTP connector action such as Get file content to get the contents of the order for further processing and storage in your orders database.
- Enter ftp in the search box on the logic apps designer then select the FTP - When a file is added or modified trigger
The When a file is added or modified control opens up
- Select the ... located on the right side of the control. This opens the folder picker control
- Select the > (right arrow) and browse to find the folder that you want to monitor for new or modified files. Select the folder and notice the folder is now displayed in the Folder control.
At this point, your logic app has been configured with a trigger that will begin a run of the other triggers and actions in the workflow when a file is either modified or created in the specific FTP folder.
For a logic app to be functional, it must contain at least one trigger and one action. Follow the steps in the next section to add an action.
Use a FTP action
An action is an operation carried out by the workflow defined in a logic app. Learn more about actions.
Now that you have added a trigger, follow these steps to add an action that will get the contents of the new or modified file found by the trigger.
- Select + New step to add the the action to get the contents of the file on the FTP server
- Select the Add an action link.
- Enter FTP to search for all actions related to FTP.
- Select FTP - Get file content as the action to take when a new or modified file is found in the FTP folder.
The Get file content control opens. Note: you will be prompted to authorize your logic app to access your FTP server account if you have not done so previously.
- Select the File control (the white space located below FILE*). Here, you can use any of the various properties from the new or modified file found on the FTP server.
- Select the File content option.
- The control is updated, indicating that the FTP - Get file content action will get the file content of the new or modified file on the FTP server.
- Save your work then add a file to the FTP folder to test your workflow.
At this point, the logic app has been configured with a trigger to monitor a folder on an FTP server and initiate the workflow when it finds either a new file or a modified file on the FTP server.
The logic app also has been configured with an action to get the contents of the new or modified file.
You can now add another action such as the SQL Server - insert row action to insert the contents of the new or modified file into a SQL database table.
View any triggers and actions defined in the swagger, and also see any limits in the connector details.