Microsoft Azure: Logic Apps (Integrations Made Simple)Publish Date: September 16, 2019
In this modern world, every enterprise wants to run its legacy systems or multiple systems alongside the emerging new technologies so that they don’t have to re-invent the wheel when planning to move to the cloud. In such scenarios, integration plays a vital role.
Integration means that an existing system could be used or extended without modifying, this seems to be a trivial task, but it gets tough if the legacy systems are Mainframe, BizTalk, etc. Logic Apps are a gift to the integration problems as they are quite easy to understand and integrate with other systems.
What are Logic Apps?
Logic apps are a server-less workflow that is created for automating or creating business processes. They are easy to use and understand as they can be visualized like a flow chart.
Logic Apps is a logical container for one or more workflows one can define using triggers and actions. Triggers can instantiate a workflow, which consists of one or many activities (actions). For instance, you can trigger a workflow by sending an HTTP request or schedule a workflow every hour to retrieve data from a public website.
Why Use Logic Apps?
The benefits of using logic apps as given below:
- Fewer development efforts as there are numerous pre-built connectors.
- No overhead of server maintenance as we are using serverless technologies.
- Later at any point, new integration endpoints can be integrated.
- Less cost as it works on consumption plan, the cost is per execution per connector used.
- The workflow-based approach is, easier to understand and visualize.
What is Server-Less Technology?
Logic Apps are server-less; by the term server-less, it is meant that there is no dedicated server for hosting the logic apps. When a request is made for logic app execution, the azure internally figures out the server where it has to be deployed and then hosts the logic app on to that server and starts the execution of the logic app. It is priced only for the time it is using compute (executing), it works on consumption plan, and even if the logic app is enabled but is not executed, there is no cost for that. One more advantage of being server-less is it auto-scales based on the demand.
Logic Apps Fundamentals
As now you already know that logic apps are workflows, they need to be instantiated or triggered on when they should run. The logic app has two building blocks of triggers and actions.
Triggers: These are the ways by which a workflow can be triggered, there are multiple triggers, but a few famous ones are:
- Http triggered (When a rest endpoint is hit)
- Blob triggered (When a blob is modified)
- SQL triggered (When a SQL table is modified)
- Service Bus triggered (When a message is received in service bus queue)
- Event Grid triggered (When an event is pushed to event grid)
- Recurrence (When a workflow has to run in the schedule for example, After every 3 days)
Actions: Actions are the step that has to be done on whether to modify the output from the previous step or perform some other operations. Action, as the name suggests, is what action has to be performed, and this is done using connectors. Connectors are the steps that makeup action.
Logic app designer
The logic app can be designed using logic app designer, first create a logic app in the Azure portal and go to the designer to design your logic app. In that select, the trigger that would make the workflow run and after that, integrate the steps what would it do. Integration of multiple technologies can be done using connectors.
There are large numbers of connectors that are already available for use for the integration of technologies. Even if there are connectors not available for your requirement, logic apps also have a provision to create a custom connector, and then it can be used to integrate the services with logic apps.
A look at how logic apps look in Azure portal:
Development of Logic Apps
Development of logic apps can be done using the portal as well as visual studio, both of these give the same interface to develop logic apps and publish it to the portal and start using the workflow based integration technology.
Security of Logic Apps
Security in its own is a vast topic; the brief on how security can be achieved in logic apps are given below.
- APIM (API Management Gateway): Placing the logic apps behind the APIM and configure the policies of APIM on how much security is required for a logic app.
- Restricted IP’s: the logic app can be configured to be accessed by restricted IP’s in the Azure portal from the workflow setting options.
These are a few important security tips; there are many other ways through which security can be achieved in logic apps.
Costing of Logic Apps
The cost of the logic app is calculated as per execution per action. Hence the number of steps and type of connectors used incurs in the cost and the number of times the workflow ran. The cost of logic apps can be calculated here.
Best Practices for Logic Apps Development
Practices that should be followed while developing logic apps are as follows.
- Minimum use of connectors
- For Ex: If we have a scenario where we are calculating the addition of two numbers, then instead of using variables, we should go for function expressions so that we don’t use any additional connectors. As the cost of the logic app is the number of times, it is fired and the connectors used in the processing. Standard connectors come with fixed price. Check the pricing here.
- Define the Scope / Architecture
- Defining the scope that architecture means the fashion in which the logic app would run, be it a publisher mode, subscriber mode | synchronous pattern | Asynchronous pattern.
- Monitoring & Alerts
- For production / live applications do have monitoring dashboards as well as azure alerts configured so that in case of anomaly, the respective owner can take action on priority.
- Polling Logic Apps
- Polling logic app comes with a hidden cost, so even if the poll returns with an empty result, it is counted as a run of the logic app. Keep the interval of the poll such that, you can operate it optimally and you have data to process after that interval.
- B2B Scenarios
- B2B scenarios might include steps such as XML validation, transformation. This can be achieved by logic app XML connector that requires the validation files (XSD’s) and the transformation files (XSLT’s) stored in integration account that comes with a fixed billing whether it is used or not. We should, therefore, wisely decide on the type of integration account to use (Free, Basic, Premium). Each tier has its advantages and disadvantages.
- Deployment Of Logic Apps
- Avoid the development of logic apps from the Azure portal. The development should be done by Visual Studio to have better source control as well as it can be a part of CI/CD. It is also possible to deploy to different environments from visual studio.
- Performance Of Logic Apps
- The performance of logic apps can be increased by multiple folds by using child logic apps instead of going for full flow in a single logic app. If there is a case where few actions need to be done over a loop, then segregate those actions into an independent logic app and use it as child logic app. This segregation is beneficial as it is a reusable component that could be used anywhere else if required. The performance is increased, as now with every call to this logic app, a new instance of the logic app is created.
Software Engineer Innovation Group – Cloud Azure