Introduction
If you are not aware of the Azure cloud and what is a logic app, then go through the details of it in my previous articles,
- An Overview of Cloud And Azure Cloud
- Pillars of Cloud And Azure Services
- Logic app overview
In this article, we will explore the SFTP connector and how to create a file in the SFTP location using the Azure logic app.
Scenario
These articles will help you to understand how to use logic app connectors. I am also providing an example of creating a file in an SFTP location using an SFTP connector in the logic app by executing step by step approach. Let’s gear up.
Pre-requisite
- Basic knowledge of Azure services
- SFTP location should be publicly available over the connector with credentials
Background
- Case 1: If we need to create and store the file in the FTP location
- Case 2: If your cloud application must integrate with on-premise data sources but you do not want to directly expose and connect with the destination data source, then there should be one middle layer like FTP files, etc. which will act as a bridge between the cloud app and on-premise data source. Cloud application will put the file in an FTP location and then your on-premise data source will pick up the file, parse it, and store the data in the data source.
(I am picking one example as FTP to explain the logic app connector, there are other approaches that can be used based on the requirement).
Details
Now, build a logic app to store the file in SFTP per five minutes.
Step 1. Sign in to the Azure portal with your Azure account credentials.
Step 2. Click on the ‘Create Source’ link, then navigate to the integration section and select ‘Logic App’.
Step 3. Fill in details of a logic app like name, its resource group, location, etc., and click on create a button.
Step 4. Portal creates and deploys the logic app, once it is deployed then click on the go-to resource link as shown in the below screenshot.
Step 5. Click on the edit button.
Step 6. The system will open the logic app designer window on which you will see the list of templates and connectors to build workflows quickly or we can create it from a blank.
I am selecting ‘recurrence’ because I want to run my logic app every five minutes in the background.
Step 7. Enter the interval as ‘5’ minutes. We can configure this at a point of time later as well based on the frequency.
Frequency options
Step 8. Click on the new step to add a new action in the logic app. Then, search for SFTP and select ‘Create file’ action.
Step 9. Now, the system prompts you to enter details about the SFTP connection. At the backend system creates a connection to SFTP by using the filled details.
Enter the connection name (can be a user-friendly name), host server address, and username and password (password is not required if SFTP anonymous access is enabled).
Note. SFTP should be public and accessible over the Internet.
Step 10. After the successful creation of the connection to SFTP, the system asks you to enter the details about the destination folder, file name, and file content.
- Folder: You can use the explorer to browse your destination folder.
- File Name: You can use dynamic properties or a static name.
- File Content: You can create dynamic content or use static content as needed.
Step 11. Now your logic app workflow is ready to use. You can save the logic app now or run it to test the newly created logic app.
Now, every five minutes a file will be generated at the SFTP location.
Summary
In this article, we have seen how to create a logic app connection and how to create a file in an SFTP location using the SFTP connection.