For the best results, it is recommended that you have basic knowledge in Azure and an active Azure subscription.

Logic App

Logic App is one of four services offered by Azure App Services. The other three services include Web App, Mobile App and API App. Logic App and API App work very closely together. All of the connectors that can be used in logic app are basically API Apps, which are available in the marketplace. In case you cannot find any connector that fulfills your needs, you can always build a custom connector using the API App.

To learn how to build a bridge between on premise servers and Azure Services (a Hybrid connection,) follow the steps below:

Creating Service Bus Connection

1) To build a hybrid connection you need to create a Service Bus Namespace. To build this namespace go to following URL:

This URL will take you to the Azure Management Portal. On the left hand side of the Menu tab, you will find a link to Service Bus, as shown below.

File-Connector (1)
Figure 1

2) Click on the “Create” button.
3) Provide a Name for the Service Bus and make sure that the Messaging tier for the Service Bus is standard. Ensure that Azure On-Premise Hybrid Connection messaging works with the Standard messaging tier.

See screen shot below:

File-Connector (2)
Figure 2

4) Once you have provided the information, click on the checkbox button (as shown above) and it will start the provision of the service bus namespace as shown below:

File-Connector (3)
5) To obtain the connection string for the service bus namespace, click on the Connection Information button at the Bottom-Middle menu shown in Figure 1 above. When you click the Connection Information, the screen shown below will popup, this is your connection string information.

File-Connector (4)
Figure 3

6) Copy this connection string and save it for using in the File Connector configuration.

Creating File Connectors

1) This File Connector is just like BizTalk server file adapter. It has been provided by Microsoft in the marketplace. To create a file connector go to the URL and click New -> Market Place and Search for File Connector (as shown below.)

File-Connector (5)
Figure 4

2) Select File Connector from the list and click Create on the next window

File-Connector (6)
Figure 5

3) Once you hit Create, you will follow the series of windows to configure your File Connector (as shown below.) The Root Folder is the main parent folder, which will be used for relative paths to pick up or drop a file. The Service Bus Connection String is used to make connection to an on-premise server. This is the same connection string that we created in the Section “Creating Service Bus Connection” above. You will also have to create or choose an existing App Service Plan. This plan determines your usage of the connector. You will also choose the Pricing Tier to determine the type of services you want. The pricing tier differs based on system resources you choose. You will also create or choose an existing resource group for your connector. The resource group is used to group different resources like connectors, pricing tiers, and the app service plan in Logic App.

File-Connector (7)
Figure 6

4) Once you have provided all details click OK and Create. This will provision the File Connector in the Resource Group, “test”. Since we are planning to move the file from one location to another, we will need the destination File Connector as well. For the destination file connector you will repeat all the above steps and provide the same Service Bus Connection.

The File Connector is not ready for use yet. The Hybrid connection on the on premise server must be set up.

Creating Hybrid Connection

1) Go to the main Portal screen from the URL and click on All Resources on the right hand side menu.
2) You will see all the resources created in different resource groups on the main screen (as shown below.)

File-Connector (8)
Figure 7

3) Click on the Name “FileConnector” and it will take you to the properties and setup page (as shown below.)

File-Connector (9)
Figure 8

4) As you can see in the above screen shot there is a warning ICON saying Hybrid Connection On-Premise Setup Incomplete. Click on the tile to setup the Hybrid connection.
5) Once you click on the Hybrid Connection tile, you will see the screen shown below

File-Connector (10)
Figure 9

6) The Hybrid Connection screen is showing you the service bus connection that will be used to connect to the on-premise server. In order to do that, it has to use IIS to deploy its services as a web application. The portal conveniently gives you the msi to install the web application on your local server. Make sure you have fully configured IIS on your machine, and find where you want the file to be picked up or dropped. Download the setup using the Download and Configure link from the above screen. Copy the Primary Configuration String, as you are going to use it to configure the IIS web application.
7) After you download and run the setup you will see the following screen. Provide the Primary Configuration string copied in step 6 above.

File-Connector (11)
Figure 10

8) Click “Install” button to install the application to IIS
9) Once the application is installed, open IIS and look for the file connector

File-Connector (12)
Figure 11

10) Explore the File Connector and open the web.config and find the section <appSettings>. For some connectors you have to manually edit the web.config file to provide the connection strings. This is something the Azure team needs to look into.

File-Connector (13)

11) Change the value of the key File_RootFolderPath to “c:temp”. This is the root folder that was provided in your configuration in the azure portal.
12) Now when you look at the connector properties in the Azure portal you will see the status from Not Connected to Connected.

File-Connector (14)
Figure 12

Follow the same steps to create another File Connector with the same Service Bus connection string and provide a different root folder. In the next section you will see how to use these two connectors in our Logic App.

The above steps have shown you how to create and configure a source File Connector. A file needs to be dropped, and in order to do that you will need another File Connector for the destination file.

Create Logic App

1) Finally you are going to use your connectors and connections to build a functioning Logic App.
2) To create a logic app go to the Azure Portal main page and select New -> Web + Mobile -> Logic App

File-Connector (15)
Figure 13

3) Click on Logic App and provide the Name, App Service Plan, Pricing tier and Resource Group. You will also need to provide Active Azure Subscription.

File-Connector (16)
Figure 14

4) Hit the Create button to create the Logic App. Once the Logic App is created it will take you to the Logic App management screen.

File-Connector (17)
Figure 15

5) Click on Triggers and Actions to open the designer for the Logic App. Alternatively you can click “Edit” on the top menu bar. All Logic App start with one trigger and multiple Actions. You are going to use your Source File Connector as a trigger, which will check with an Interval to see if there is any file in the folder. You will use the Destination File Connector as an action to drop the file to another location (as shown above there is a top menu bar.) The Run Now button triggers the logic app on demand. This only works when you use the Occurrence connector as a trigger. If you use any SaaS connector, Run Now will give you an error. The disable button is used for enabling or disabling the Logic App flow. The same screen shows you how many instances of Logic App have been executed. It also shows how many are successful and how many have failed. If you click on any failed instance, it will tell you which step failed and what the error was. Sometime the errors are not very useful, and this is something we can report to Azure team to add useful errors, instead of the typical “something went wrong”.

6) Click Edit or the Triggers and Action tile and you will see screen below:

File-Connector (18)
Figure 16

7) As you can see in the above screen shot, you can either create a blank logic app from scratch or you can use pre-defined templates that might fit your needs. Click on Create from the Scratch tile.

8) After clicking the tile you should see the screen below with the platform to drag and drop your trigger and actions. On your right hand side of the screen, you have the tool box with all the resources that are in your resource group that you initially created and also the connectors that you can search and add from the marketplace.

File-Connector (19)
Figure 17

9) You are going to drop the first File Connector which is named as “FileConnector”. The custom name of the connector is displayed under the connector in small font. Click on FileConnector

10) This will drop the file connector as a trigger to our logic app. See screen below. As you can see the trigger below shows you the available function that you can choose. In the case of file connector you have the Read the Delete function, which will look for a file in the root folder. Click on the function File Available (Read then Delete).

File-Connector (20)
Figure 18

11) Once you click on File Available (Read then Delete) you will see the screen below. In the configuration of the trigger you will specify the polling interval for the trigger. In this example it will take one hour to look for a file. The time period can go in seconds, minutes, hours or days. If your file is in the root folder then you can use “.” to read the file, or you can use the relative path of subfolders like “/pickup/”. There are two file formats that you can use to read, either you can read the file as text or you can use binary format. File Mask and Exclude file mask gives the flexibility to filter the file extension that you want to pick up or don’t want to pick up.

File-Connector (21)
Figure 20

12) After configuring the trigger, click the green check button to save the trigger setting. Once you save the trigger it will create a blank space for you to add action. Click on your destination file connecter that you created, in this case it is “FileConnector1”. As you can see below, the connector is now offering a different function, since you are using it as an action. For this example Upload File Action is going to be used.

File-Connector (22)
Figure 21

13) Once you click Upload File Action it will show the screen below. The file path could be a relative path for a root folder that was configured for the destination connector. You can also see a function/expression call to get the file name from the trigger input. Logic App supports different kinds of functions as expressions. To call a function you need to add “@” sign to it. Such as @concat (…,…) or if you want input from the trigger you can write @{triggers().outputs.body.FileName}. The content field is the text or binary content of the input trigger that was used to read the file. For encoding use the standard encoding field, and for text file do not using encoding.

File-Connector (23)
Figure 22

File-Connector (24)
Figure 23

14) Once all the fields are set click the green tick button and save the configurations. Then finally save the Logic App from the top menu bar.

File-Connector (25)
Figure 23

15) Once the logic app is saved, the first execution will take place. Make sure you have a text file placed in your drop location. After the first execution, the next execution will take place every hour. You cannot use Run Now option with SaaS connectors as a trigger. The Azure team should provide this for you. Once the execution is complete you will see the file transferred to your destination folder. The screenshots below show you the successful execution scenarios.

File-Connector (26)
Figure 24

File-Connector (27)
Figure 25

File-Connector (28)
Figure 26

By following the above steps you will have successfully created and deployed a running Logic App application, and transferred a text file between two on premise servers. Keep an eye out for future blogs that will show you how to use SQL Connectors to migrate data from an on premise server to a SQL server in the cloud.