Azure Logic Apps - Hello World

Introduction

Logic Apps are a relatively new feature of Microsoft Azure that makes it simple to build complex workflows using one or more of the over 200 plus different connectors. Since the Logic Apps are serverless, you do not need to worry about server sizing. The platform will scale to meet your demand, and better yet, you're only charged for what you use.

I was in a coffee shop the other day and overheard Ana and Mark having this conversation.

Ana says, “Hey, have you heard about Azure Logic Apps?
Mark says, “No, what's that?
Ana says, “It's a Serverless fully managed iPaaS”.
To which Mark asks, and this is a very important question, “What's wrong with what I currently have?
 
This is a very common question that people ask when they're introduced to a new technology or new product, and the decision of whether or not you should learn this new product could depend on the answer to this question because, let's be honest, it does not make sense to learn a new technology unless and until it can significantly improve the way we work today, so let me try to explain the answer to this question on Ana's behalf.

Azure Logic Apps

I am quoting this line from a Gartner report on Integration maturity model. Although the report is a little old, what it says still holds very true even today.

Here is what Tord Glad Nordahl answered in the open Q&A with product group at 100th Episode of integration Monday...

If your solution need to communicate with SaaS application, Azure workloads and cloud business partners (B2B) all in cloud then you should use Azure Logic Apps, but if you are doing lot of integration with on-premise processing by communicating with on-premise LOB applications, then BizTalk is the pretty good option. You can use both if you are doing hybrid integration.

I hope this answers the major part of the question, what's wrong with what I currently have? If you are looking for more details you can search for the report online.

Logic Apps brings speed and scalability into the enterprise integration space. The ease of use of the designer, variety of available triggers and actions, and powerful management tools make centralizing your APIs simpler than ever. As businesses move towards digitalization, Logic Apps allow you to connect legacy and cutting-edge systems together. Additionally, with our Enterprise Integration Account, you can scale to mature integration scenarios with the power of an XML messaging, trading partner management, and more.

Let's think about this as a developer:  “What are AZURE LOGIC APPS?”

As easy as it might sound, Application integration in the cloud does require some EFFORT, CREATIVITY and lots of COFFEE.

Azure Logic Apps  Azure Logic Apps  Azure Logic Apps

Why use Logic Apps?

Logic Apps provide a way to simplify and implement scalable integrations and workflows in the cloud. It provides a visual designer to model and automates your process as a series of steps known as a workflow.

With businesses moving toward digitization, logic apps help you connect legacy systems, modern, and cutting-edge systems more easily and quickly by providing prebuilt APIs as Microsoft-managed connectors. That way, you can focus on your apps' business logic and functionality. You don't have to worry about building, hosting, scaling, managing, maintaining, and monitoring your apps. Logic Apps handles these concerns for you. Plus, you pay only for what you use based on a consumption pricing model.

Logic Apps is a fully managed iPaaS (integration Platform as a Service) allowing developers not to have to worry about building hosting, scalability, availability, and management. Logic Apps will scale up automatically to meet demand.

The beauty of Logic Apps is that Microsoft provides tons of connectors that will enable you to connect quickly through various protocols and with a wide range of applications. And it runs in the cloud meaning that you as a developer have to worry less about hosting, scalability, availability, and management. As a developer, you can focus on the connectivity and logic in the Logic App. Add a trigger, a few actions, configure, safe, secure, test and you are ready to add value to your business. Integration is done at the speed of light, or in other words, integrations will no longer be a bottleneck for IT to run at the speed of business.

How do Logic Apps work?

Every logic app workflow starts with a trigger, which fires when a specific event happens, or when newly available data meets specific criteria. Many triggers include basic scheduling capabilities so that you can specify how regularly your workloads run. For more custom scheduling scenarios, start your workflows with the Schedule trigger.

If you want to know more about how to build schedule-based workflows, check below article;

https://docs.microsoft.com/en-us/azure/logic-apps/tutorial-build-schedule-recurring-logic-app-workflow

Each time that the trigger fires, the Logic Apps engine creates a logic app instance that runs the workflow's actions. These actions can also include data conversions and flow controls, such as conditional statements, switch statements, loops, and branching. For example, this logic app starts with a Dynamics 365 trigger with the built-in criteria "When a record is updated". If the trigger detects an event that matches these criteria, the trigger fires and runs the workflow's actions. Here, these actions include XML transformation, data updates, decision branching, and email notifications.

Azure Logic Apps

Azure Logic Apps component

  • Workflow
    This is used to define the different steps of your business process, using a graphical user interface. Visualize, design, build, automate, and deploy business processes as a series of steps.

  • Managed Connectors
    These are used to connect to different data sources and services. Azure LogicApps provide an in-built set of managed connectors that cover different areas like social media, file FTP and many more.

  • Triggers
    This initiates a workflow and creates a new instance of the workflow. A trigger can be an arrival of a file on FTP site or receiving an email. There are different types of triggers

    • Poll triggers
      These triggers poll your service at a specified frequency to check for new data. When new data is available, a new instance of your logic app runs with the data as input.

    • Push triggers
      These triggers listen for data on an endpoint, or for an event to happen, then triggers a new instance of your logic app.

    • Recurrence trigger
      This trigger instantiates an instance of your logic app on a prescribed schedule.

  • Actions
    An action represents a step in the workflow. It can invoke an operation on your API. Each action usually maps to an operation that's defined by a managed connector, custom API, or custom connector.

  • Enterprise Integration Pack
    For more advanced integration scenarios, Logic Apps includes capabilities from BizTalk Server. The EIP connectors provide functionality like BizTalk. These connectors are used for complex enterprise integration scenarios such as XML messaging and Validation. It supports exchange messages through industry-standard protocols, including AS2, X12, and EDIFACT. It requires an "Integration Accounts" to store different artifacts, like schemas, partners, certificates, maps and agreements.

Demo

Before you start the demo, you need an Azure subscription. If you don't have a subscription, sign up for a free Azure account. You can Create your Azure free account today.

  1. Sign in to the Azure portalwith your Azure account credentials. Once you successfully sing-in to Azure portal, you will see land on Azure dashboard like below screen shot,

    Azure Logic Apps
  1. Now, you can create your first logic app. There are many ways to create the logic apps but for now, see this process. For that, first, click on "Create a resource" button on the left top panel. One window will expand where you have to select Enterprise Integration, once you click on that many features will come in a list. Here you can click on Logic App. Refer to the below screen shot for all steps.

    Azure Logic Apps
  1. A new window will appear with the name ‘Create logic app’. Here, you have to fill in all the details like below - Name, Subscription, Resource Group, Location, Log Analytics and Pin to dashboard. Once you fill everything, it will be like this.

Name => FirstLogicAppDemo => The name for your logic app

Subscription => Dev => The name for your Azure subscription

Resource group => Mumbai-India => The name for the Azure resource group used to organize related resources

Location => Central India => The region to store your logic app information

Log Analytics => Off => Keep the off setting for diagnostic logging

Pin to dashboard => Checked => Logic app will come on dashboard.

Azure Logic Apps

  1. When you create a logic app, then it hardly takes a minute to deploy your logic app. After that, you will land on the new site where you can see some common triggers and templates. If you want to use any pre-defined template, then click over it otherwise you can click on Blank Logic App.

    Azure Logic Apps
  1. Once you click on Blank Logic App, the logic apps designer page will open just like the below screenshot and there, you can find all default triggers. As explained above, logic apps start with a trigger. In this demo we are going to use C# corner rss feed to check any recent posts and send the mail with details. So here you have to type RSS in the search box, refer to the below screen shot for details.

    Azure Logic Apps
  1. When you search RSS, you will find the trigger ‘RSS – When a feed item is published’. You have to select that trigger. Once you select it,  it will ask you the RSS feed URL, in this demo our feed URL will be http://www.c-sharpcorner.com/rss/latestcontentall.aspx. Then you can configure how often you want to check for items, here in interval you can put any number of intervals and frequency will contain the unit of time for each interval. Here we set it on an hourly basis.

    Azure Logic Apps
  1. Now, your trigger is configured successfully. Let's jump to the next step that is your action. Click on "New step" and then click "Add an action".

    Azure Logic Apps
  1. Here, you will find all the action lists. For our demo, we are going to use Gmail connector to send the email. So here, you have to type ‘gmail’ and you can find the connector named ‘Gmail – Send email’. Click on that.

    Azure Logic Apps
  1. Once you select "Gmail - Send email" connector, this will ask you to sign in to the Gmail account. Refer to the below screenshot.

    Azure Logic Apps
  1. Once you click on the sign in button, a new window will open and redirect you to the Gmail authentication site where you have to put in your username and password for authentication. 

    Azure Logic Apps
  1. Once successful authentication is done, it will come back to the logic app and here, it will ask to whom you want to send your email, and with what subject and body.

    Azure Logic Apps
  1. Put in all of the information. In this case, I am putting my Gmail address and in subject. I am putting in some detail like, ‘Recent post on C# corner | and Feed title’.

    Azure Logic Apps
  1. After that, we will be putting some content in the body. I am choosing parameters such as the feed title, when it was published and a link to that feed. Refer to the below screen shot.

    Azure Logic Apps
  1. That’s it for how you can save you logic app and manually execute your logic app. For that, you just need to click on the Run button as shown in the below screenshot.

    Azure Logic Apps
  1. Or the other way to execute your logic app, is to go one step back and click on ‘Run Trigger.’ Once you click on that you can find the Trigger history and Run history like the below screen shot. If the RSS feed has new items, your logic app sends an email for each new item. But if the feed doesn't have new items, your logic app skips firing the trigger and waits for the next interval before checking again.

    Azure Logic Apps
  1. For example, here is a sample email that this logic app sent,

    Azure Logic Apps
  1. If you don't get any emails, check your email's junk folder. Your email junk filter might redirect these kinds of mails.

Congratulations, you've built and run your first logic app.

Summary

In this article, we saw how to create your first simple Logic Apps. I hope you’ve found this post handy. Feel free to add your comments or ask any questions below. If there's anything specifically that you want me to cover with respect to Logic Apps please let me know.