Share via


Microsoft Azure: Building a Logic App

Introduction

You can build integration solutions with BizTalk Server, a server product from Microsoft intended to provide large scale Enterprise Application Integration. The rise of the internet, mobile devices, Software as a Service, Internet of Things the demand for hybrid- and cloud integration becomes apparent. Therefore Microsoft has created services in Azure to provide you capabilities to build such solutions. The Service Bus has the capabilities to build brokered and direct messaging with queues, topics and subscriptions, and relays. Another service, BizTalk Services, was intended to build integration solution to bridge cloud with on premise Line-Of-Business systems. Going forward Microsoft has based on the BizTalk Services and Micro services paradigm build Apps service.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/App%20Service%20Overview%20Diagram_zpshakvwqgr.png

**Figure 1. **App Service Overview.

The App Service is a collection of web-, mobile, logic and API apps as depicted in the above diagram. And in this article we will go into building a simple Logic App. A Logic enables you to build an automated process across SaaS and on premise using a Browser. You log into Azure Portal, go to preview portal in case you land on the current portal. This is the starting point to create a Logic App. Note that the Logic App i.e. App Service is still in preview mode until later this year when it will become generally available.

Logic App Concepts

The Logic Apps with App Service are intended to build a business process i.e. workflow hosted in Microsoft Azure based on a price plan. Price plan is based on non-functional requirements. Functional requirements will drive the logic. Logic consists of triggers and actions. A Trigger based on an event will instantiate the workflow and actions are step(s) after the trigger. Some of the integration capabilities found on BizTalk Server like mapping, rules, validation and more can be found in Marketplace apps.

Sample scenario

In this article we are going to build a simple Logic App that runs every hour collect Tweets with a certain hashtag, and route them a Service Bus Queue named tweets.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/Functional_zpsh8pou7lx.png

Figure 2. Functional diagram of the Logic App.

Building a Logic App

Login into the Azure Portal and go to preview portal if necessary. In the above left corner you can click NEW and select Web + Mobile. Here you can find the Logic App. Click on it to create one.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/Create%20a%20new%20Logic%20App_zpsyjmkzkfr.png

**Picture 3. **Create a logic App from the Market Place under Web + Mobile.

Note that whenever you create a new API, App, Logic App, Web App or Mobile App, you need to specify the App Service Plan that provides the pricing container for your service. Once that’s done, you cannot alter it. When you click on Logic App a new pane will appear, where you specify a name for you Logic App.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/My%20First%20Logic%20App_zpsiwuilm1s.png

**Picture 4. **Provision the Logic App.

Once you click create a Logic App will be provisioned for you. It is an empty container with no logic with some default settings i.e. Pricing Tier, Resource Group, Subscription, Location and Logic (triggers and actions). The settings cannot be altered except for the logic i.e. trigger and action. As soon as your Logic App is provisioned, you can start creating some logic for it by dragging and dropping triggers and actions. You click triggers and actions in your Logic App and a design pane will appear in your browser.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/Create%20Logic%20App%201_zpsvak3pjtd.png

Picture 5. Logic App Design Canvas.

At the right side of the pane shapes can be found to function as a trigger and subsequent actions. The shapes are from API Apps Library. For this scenario a Recurrence shape (trigger) and two subsequent shapes (actions) have placed on the canvas.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/Complete%20Logic%20App_zpssafnodus.png

Picture 6. The Logic App Trigger and Actions.

Based on price plan you can specify the recurrence of the Logic App. Free price plan means the Frequency cannot be under 1 hour. Once you click Twitter Connector you will have to authorize to have access to a twitter account (OAuth on the background taking care of this). Subsequently, you can specify what the connector has to do. In this case look for tweet text with a certain hashtag.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/Create%20Logic%20App%203_zpsjwzl04sd.png

**Picture 7. **Add a trigger and action.

Next action following the Twitter Connector will be the Azure Service Bus Connector. You need to provide the connection string for the Service Bus i.e. namespace. Subsequently you can specify what this connector needs to perform. Sending a message i.e. the body of the tweet to the specified queue.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/Create%20Logic%20App%204_zpscxybl117.png

**Picture 8. **Edit the action.

In the design pane, you can click to code view to see the JSON belonging to the specified logic. This will give the ability to store the logic in case you like to reuse it.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/Logic%20App%20Code%20Behind_zpsbwgkkqk1.png

Picture 9. Code View of the Logic App.

Logic App in action

The Logic App runs every hour and collects the tweets containing the specified hashtag and sends these to Service Bus Queue.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/SB%20Explorer_zps3duqpgl7.png

**Picture 10. **Service Bus Explorer, inspecting the messages on the tweets queue.

By connecting to the Service Bus Queue using the Service Bus Explorer the Tweets can be viewed.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/Trigger%20History_zpssgzard6o.png

Picture 11. Review the trigger history.

In the browser the trigger history of the Logic App can be inspected.  In case a run has not succeeded you can click on the failed run. Navigate to failed step and click on the in- or output link.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/TroubleShooting_zpst0pjifst.png

**Picture 12. **Review the run of the Logic App instance.

By clicking one of the operations the actions in the Logic App can be inspected.

http://i208.photobucket.com/albums/bb152/Steef-Jan/Logic%20App%20Article/Error%20Output_zpsdimrrzia.png

**Picture 13. **Look into an error in a Logic App instance.

The output can be analyzed to troubleshoot the error.

Wrap up

The Logic App is part of the App Service and currently in preview. This means it is still in the early stages and you experience bugs or awkward behavior. However, do not be discouraged as bug fixes as done every day based on feedback from users. The Logic App will improve every day and you can expect:

  • Convoys, Long running process, Auto Delivery
  • Large Message handling
  • Azure services available on premise (Azure Pack)
  • Built-in designer for Logic App in Visual Studio
  • Better error messages

Resources

The following resources can be beneficial in case you are doing research or are exploring the capabilities of the Logic App:

Other languages

See Also

Another important place to find a huge amount of Logic Apps related articles is the TechNet Wiki itself. The best entry point is Microsoft Azure App Service Resources on the TechNet Wiki.