Azure Integration: 1 – Azure Logic Apps an Introduction

Logic Apps are part of Azure Integration collection. Azure integration is a collection of various Azure tools and frameworks that addresses all integration needs for an Enterprise. Logic Apps are used for core workflow processing. Service bus is Microsoft’s cloud-based queuing mechanism. It provides a durable queuing infrastructure that is highly scalable. Event grid is Azure’s event processing system. It provides near real-time eventing to many events inside Azure. API Management is used to safeguard and secure both internal and external APIs. Azure integration is functions are a lightweight streamlined unit of work that can be used to perform specific tasks. Using the on-premise Data Gateway, Logic Apps can seamlessly call into your on-premise systems. The on-premises Data Gateway has support for many systems including on-premise SQL server, SharePoint, SAP, IBM DB2, as well as BizTalk Server. The on-premises Data Gateway can even be used to monitor a local filesystem. This blog addresses Logic Apps only.

Logic Apps Advantages

  • Logic Apps is a serverless platform which means is you don’t have to worry about the management of those servers.
    • Auto-Scaling: You simply deploy your resources and the framework will ensure it gets deployed to the correct environments. You also have auto scaling based on demand. Unlike building out a SQL Azure database where you must specify a resource size, when you need more resources for your Logic Apps, they will automatically be provisioned by the platform and your solution will auto scale to meet your demand. Along with this is high availability. This is just built into the platform.
    • Use-based billing. What this means is you only pay for the resources that you use.
  • Easy to learn as Logic Apps provides a drag and drop developer experience.
  • 200+ different connectors for integration with PAAS and SAAS offerings, and on-premise systems. This suite of connectors is constantly growing and expanding. Including Enterprise connectors for systems like IBM, MQ, and SAP. In addition to support for AS2, X12, and EDIFACT messaging.
  • Ability to create custom connectors around APIs, so you can provide a custom development experience for your developers.
  • Monitoring and logging right out of the box. It is built right into the framework and accessible via the Azure Portal.
  • Seamless integration with other Azure features. This provides a rapid development experience for integrating with service bus, Azure functions, custom APIs, and more.
  • It’s easy and extremely powerful.
  • Logic Apps are very good at connecting cloud-based systems, bridging connections from on-premise systems to the cloud and vice versa. Azure Integration and Hybrid Solutions

Design and Development of Logic Apps

You have two options for building our Logic Apps:

  • The web-based designer is a simple convenient option that hosts the designer right inside the Azure portal. This designer is feature-rich and allows you to author your Logic Apps very quickly. One of the big benefits of the web-based designer is it’s very easy to test your Logic Apps because they’re already sitting out there inside your Azure subscription. The web-based designer works great for building short Logic Apps or doing proof of concepts.
  • There’s also a designer a plug-in that supports Visual Studio. The Visual Studio plug-in is a great choice for authoring Enterprise-grade Logic apps. However, you will need to deploy them into an Azure subscription to run them.

There are a couple different deployment options. Inside the web designer, you can clone your Logic App, and you can move them to other resource groups, and even other Azure subscriptions. If you’re using the Visual Studio Designer, you can create an Azure Resource Management, or ARM, template. With the ARM template, you can then use PowerShell to deploy your Logic Apps into your Azure subscription. Using the ARM templates in PowerShell, it’s very simple to deploy your Logic Apps into multiple Azure subscriptions. This makes it easy for rolling out Logic Apps to multiple environments. Another benefit of the ARM templates is that they can be checked into source control.

Connectors

Connectors are pre-built, Microsoft managed wrappers around APIs to greatly simplify interaction with those systems Connections contain environment-specific details that a connector uses for connecting to a data source including destination and authentication details. Connections live at the Resource Group level. Connectors show up inside the Azure portal underneath the segment called API connections. Under API connections, you will see all of your individual API connections that you have created inside of that Resource Group. Connections can be created using PowerShell or using the web or Visual Studio Designer. The connections that you create for your connectors can be independently managed outside of your Logic Apps. You can go under API connections inside the Azure Portal and edit connection information. You will also see your connections show up underneath your Logic App. The connections that you create for your connectors can be shared across multiple Logic Apps.

Triggers

Now let’s talk about the different ways that we can start a new instance of a Logic App. Triggers are used to initiate a Logic App. Triggers can be broken down into two main types, reactive and proactive.

  • Recurrence trigger, you specify a time interval in which that Logic App will execute.
  • Polling-based triggers., you specify a polling interval in which the Logic App will wake up and look for new work to do based on the connector that you’re using for the trigger.
  • Event-based which the Logic App can be triggered off of events that happen inside of Azure.
  • TTP and webhook triggers, so inbound HTTP requests can start your Logic Apps.
  • You can write custom API apps and use them as triggers for your Logic Apps as well.

Actions

Actions are the building blocks of Logic Apps. Most actions are also connectors. There are a few different ways to add new actions to a Logic App. The first way is at the end of the Logic App. Underneath all the other actions you will see a button to add a new step. If you click this button, you will be able to add a new action. If you are working with actions like the scope or condition action, you have the ability to add additional actions inside them. At the bottom of that action, you will see an add action button. The last way to add a new action inside a Logic App is in between two existing actions. Simply hover between the existing actions, and a plus will show up. Click on the plus and you will have the ability to add an action in between the two existing ones. Once you add a new action, the add action dialog box will pop up. This will give you the ability to search connectors and actions to find what you’re looking for. You can also narrow it down by selecting All, Built-in, Connectors, Enterprise, or Custom. This will display all the connectors that are available. When you click on a connector, it will list all available actions that are supported by that connector. Most connectors have more than one action. If you do not select a connector, you can simply select actions in the Actions selection menu and scroll through all available actions. There’s a lot of actions available to you. Since there’s so many actions available to you, it’s highly recommended to select the connector first and then see the list of available actions for that connector

Flow Control

Flow control is used to control the sequence of logic through a Logic App. All flow control actions are listed under control.

  • The if-then logic is very popular. It is used to supply a condition and then if that condition evaluates to true executes certain logic, if it evaluates to false, you would execute different logic. Inside the Logic App Designer, you have a rich condition editor where you can add multiple parameters to a single condition. You could also switch to advanced mode and edit this in JSON if you need more control over your condition.
  • Switch allows you to choose on a value and have multiple cases based on that value. There’s also a default case if none of the matching cases evaluate to true.
  • For-each allows you to loop around an array. Any array in preceding actions are available for selection for your for-each. You simply select your array in the select an output from a previous step text box, and it will automatically loop over those elements. One thing to point out about the for-each inside a Logic App is that the default behavior is to run in parallel. So by default, the Logic App will execute 20 concurrent calls to your for-each, looping around your array elements. To change this behavior, you would simply click on the … on the right side and go to settings. Underneath settings, you would select override default, and here you can change the degree of parallelism. You would simply slide it all the way down to the left to 1 if you want it done to run in sequence. This supports up to a maximum of 50 concurrent executions.
  • Do until. This allows you to select a condition to evaluate and loop around a set of actions until that condition is true.
  • Scope actions can also be used inside a Logic App. The scope action allows you to group multiple actions together and then have evaluations done on the results of the group of actions as a whole. This can be useful if you want to ensure multiple steps are successful before you continue on in a Logic App. The scope shapes will return the results of every action inside that scope as an array.
  • Terminate allows you to end the execution of your Logic App based on conditions you define in your workflow. When you add the terminate action to your Logic App, you can set the status. You can set the status to either failed, canceled, or succeeded. You can also set the error code and the error message for while you’re terminating your Logic App.