Azure Logic Apps
Article by Nirali Gandhi, Big Data & Cloud Lead Developer
Azure Logic Apps is a cloud service that helps you schedule, automate, and orchestrate tasks, business processes, and workflows when you need to integrate apps, data, systems, and services across enterprises or organizations.
Logic Apps simplifies how you design and build scalable solutions for app integration, data integration, system integration, Enterprise Application Integration (EAI), and business-to-business (B2B) communication, whether in the cloud, on-premises, or both.
How does Azure Logic Apps Work?
A Logic App works based on the workflow defined. It starts with a trigger, which fires when a specific event happens, or when newly available data meets specific criteria. Each time that the trigger fires, the Logic Apps engine creates a logic app instance that runs the actions in the workflow. These actions can also include data conversions and workflow 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 this criterion, the trigger fires and runs the workflow’s actions. Here, these actions include XML transformation, data updates, decision branching, and email notifications.
- Workflow — Visualize, design, build, automate, and deploy business processes as a series of steps.
- Managed connectors — Logic apps need access to data, services, and systems. You can use prebuilt Microsoft-managed connectors that are designed to connect, access, and work with user data.
- Triggers — Triggers are the starting point for a Logic App workflow that will fire when new data or event that meets the trigger condition occur. Users can also define multiple triggers in a Logic App. Some connectors provide triggers, which come in below types :
- Polling Triggers — It regularly checks the service endpoint for new data. When new data exists, the trigger creates and runs a new workflow instance with the data as input.
Eg. Recurrence Trigger lets you set the start date and time plus the recurrence for firing your logic app, When an email is received trigger lets your logic app check for a new email from any mail provider that’s supported by Logic Apps (For eg. Outlook.com, Gmail, etc.)
- Push Triggers — Listens for data at a service endpoint and waits until a specific event happens. When the event happens, the trigger fires immediately, creating and running a new workflow instance that uses any available data as input.
Eg. The Request Trigger can receive incoming HTTPS requests, The HTTP Webhook Trigger subscribes to a service endpoint by registering a callback URL with that service. That way, the service can just notify the trigger when the specified event happens, so that the trigger doesn’t need to poll the service.
- Actions — Actions usually maps to an operation that’s defined by a managed connector, custom API, or custom connector.
Steps to create the Azure Logic Apps
- Sign in to the Azure portal with your Azure account credentials
- From the Azure home page, in the search box, find and select Logic Apps
- On the Logic Apps page, select Add
- On the Logic App pane, provide below details about your logic app. After you’re done, select Create
- Name — <logic-app-name> [Your logic app name, which can contain only letters, numbers, hyphens(-), underscores(_), parentheses((,)) and periods(.)]
- Subscription — <Azure-subscription-name> [Your Azure subscription name]
- Resource Group — <Azure-resource-group-name> [The name for the Azure resource group used to organize related resources]
- Location — <Azure-region> [The region where to store your logic app information]
- Log Analytics — <On/Off> [Keep the Off setting for diagnostic logging]
5. After Azure deploys the Logic Apps, you can find them and select your logic app by typing the name in the search box
Steps to create the Workflow in Azure Logic Apps
Let’s start with creating a workflow in the Logic App, adding a trigger and an action, and testing the Logic App.
Eg. Assume to build a workflow in the Logic App that regularly checks a customer’s request from an online portal which creates an entry into the SQL Server Table. On the creation of the customer entry in the SQL Server Table, it will trigger an e-mail to the supervisor for approval/rejection and also send a notification to the customer via e-mail. Once the Supervisor approves/rejects the request via e-mail, the customer gets the approved/rejected notification e-mail.
- Select your Logic App by typing the name in the search box
- Under Templates, select Blank Logic App
- Add a SQL Server Trigger, to connect to the SQL Server Table, by mentioning the Server name, Database name, Table Name, and the recurrence parameter to check the condition at a particular time.
4. Add a SQL Server in the next step, and choose the action Insert row (V2), where you need to provide the Table Name and static/dynamic content to the column fields. This action will be executed whenever any new customer request has been entered is made in the SQL Server Table.
5. In the next step, send a new email to the customer to show the record in Pending status. So, choose Outlook and Send New Email as an action
6. Add a parallel step to the previous one, select Outlook, and Send approval email as an action, where you need to provide the Supervisor email address to approve/reject the customer request, Subject Name, User options, Importance, etc.
7. Add the next step to the previous one, to insert the record in the table with the Approved/Rejected status. So, choose SQL Server and Insert Row as an action. This step will be executed, once the Supervisor Approve/Reject the customer’s request.
8. In the next step, choose Outlook and Send New Email as an action, to intimate the customer via email about his request status.
Pricing Model for Azure Logic Apps
- Consumption Pricing Model
For new logic apps that run in the public, “global”, multi-tenant Azure Logic Apps service, you pay only for what you use. In the Logic App, each step is an action, and Azure Logic Apps meters all the actions that run in your logic app.
- Fixed Pricing Model
An Integration Service Environment (ISE) provides an isolated way to create and run logic apps that can access resources in an Azure virtual network. Logic apps that run in an ISE don’t incur data retention costs. During the creation of ISE, you can choose an ISE level or SKU, which have different prices.
- Integration Accounts
A fixed pricing model applies to integration accounts usage at no additional cost, based on your ISE SKU :
- Premium ISE SKU — A single Standard Tier Integration Account
- Developer ISE SKU — A single Free Tier Integration Account
Each ISE SKU is limited to 5 total integration accounts. For an additional cost, you can have more integration accounts, based on your ISE SKU:
- Premium ISE SKU — Up to four more Standard accounts. No Free or Basic accounts
- Developer ISE SKU — Either up to 4 more Standard accounts, or up to 5 total Standard accounts. No Basic accounts.
Difference between Azure Logic Apps and Azure Functions
Similar to Azure Logic Apps, Microsoft provides a similar service named “Azure Functions”.
Azure Function is an event-driven, compute-on-demand experience that extends the existing Azure application platform with capabilities to implement code triggered by events occurring in Azure or third party service as well as on-premises systems.
Please find below the list of differences and use case scenarios.
Advantages of Azure Logic Apps
- Easy to Define the Workflow — User can easily define the workflow with triggers and actions with user-intuitive GUI
- Easy debugging — User can easily debug the Logic App using Trigger and Run history
- Automation of workflow — By defining the workflow with triggers, it will automatically fire the Logic App when the trigger condition is succeeded
- Integration with on-premise solutions — It is also possible to integrate the Logic App with on-premise solutions like BizTalk Server, SAP, and more
- Support for Enterprise applications — Logic Apps support integration with Office 365, Twitter, Dropbox, and more