Create a simple Logic App in Microsoft Azure

By

July 4, 2017AzureNo comments

Logic app is Microsoft’s answer for IFTT like service. For those who don’t know logic apps , we can develop a simple web app using just blocks of workflows and connectors. Microsoft provides some out of box connectors for example, if you want to send an email every time a tweet is posted then you can simply use twitter connector. In this tutorial we will create a simple Logic App in Microsoft azure. The task which we are trying to accomplish is to make the app to send an email when a new http request is posted.

 

Each logic apps works in the concept of Trigger and action. Here in our example

 

Logic App in Microsoft Azure

Login to Azure portal and click new + button and select Logic apps

Logic App in Microsoft Azure

Enter the app name and resource group details.

 

Once the deployment is successful you will see the notification

Logic App in Microsoft Azure

Once you open the new logic app from dashboard you will see the common triggers

 

 

Logic App in Microsoft Azure

For this tutorial I will select “When an HTTP request is received”

 

Click edit and enter a sample json message to generate the schema.

 

Sample json :

{

“subject”:”This is a test”,

“message”:”This is a test message”,

“to”:”vikiganeshgadhi@gmail.com

}

 

Once you enter this json sample the system will generate the schema for this message format and updates the trigger.

 

Generated Json Schema.

{

“type”: “object”,

“properties”: {

“subject”: {

“type”: “string”

},

“message”: {

“type”: “string”

},

“to”: {

“type”: “string”

}

}

}

 

Click New step and add action

Logic App in Microsoft AzureLogic App in Microsoft Azure

Action is what you want to do if the trigger situation occurs. Here in this tutorial, we have to send an email. Search for “outlook.com send an email” and choose the action

 

The consequent step will redirect you to authenticate the outlook.com email address which you intend to use. This will be the email from address.

 

Once configured the essential email fields has to be chosen. We are going to use the values received from the http post message.

 

 

Click Save. You have created a Microsoft Azure Logic app.

 

In the request section you can now copy the url for this logic app. You can use this URL to make http requests to trigger the email.

 

Now to send out an http request I will be using https://www.hurl.it/  website. It is simply an online tool to initiate http requests to the urls.

 

Testing:

 

Copy the logic app url and paste it in the hurl.it website and add the header parameter “content-type” to json.

 

Logic App in Microsoft Azure

 

In the request body you can input a sample json to test the logic app. Click launch request. This will initiate a post request to our app and in turn trigger the email connector.

 

In the azure dashboard you can see the request which we made is logged and the status is displayed on the page.

Logic App in Microsoft Azure

 

This successfully sends the email to the to address.

Logic App in Microsoft Azure

 

Related posts:

Leave a Reply

*