Monday, November 19, 2018

Azure Logic Apps – an introduction


Introduction


Azure Logic Apps and Functions are precise cloud services and the backbone of serverless architecture in the Azure cloud. They both allow developers to rapidly create and deploy code to the cloud that needs to be scalable, lightweight and fast. Here we are going to talk about Azure Logic Apps only as well will meet an example.

As I stated the Azure Logic Apps service is "serverless", it doesn't mean there are no servers, it just means the developers do not have to worry about the underlying infrastructure, scale or instances.  All you have to do is describe the workflow with a trigger and the actions that the workflow executes. The underlying platform handles scale, availability, and performance. It is a fully managed IPAAS (Integration platform as a service) cloud service that helps you to build automated, scalable workflows that integrate apps and data across cloud services and on-premises systems.

Azure Logic Apps provides a visual designer for configuring the workflows. You can define a workflow with connectors and logic creation using inbuilt standard connectors and enterprise integration connectors. It is especially useful for use cases and scenarios where you need to coordinate multiple actions across multiple systems.

Components


Basically Azure Logic Apps are composed of four components:
  1. Workflow 
  2. Managed Connectors
  3. Triggers 
  4. Actions


Workflow


Logic Apps provides a graphical mode to define the different steps of your business process as a series of steps or a workflow.

Managed Connectors

Managed connectors are the most basic element in any Azure Logic Apps. They are code elements bundled together, created specifically for connecting to and working with data. Each connector defines its own API and requires some information to be configured in order to connect to the corresponding service.

Azure Logic Apps provide an in-built set of managed connectors that cover different areas like social media, file FTP and many more.

Triggers

Trigger initiates a workflow, and create a new instance of the workflow something an event like a file being dropped on an FTP site or the arrival of an email.

Each connector provides its own trigger definition, though some managed connectors can also act as a trigger.

Action

An action represents a step in a Logic Apps definition (workflow), it includes triggers, control flow steps like conditions, scopes, for-each loops, do-until loops, calls to connectors and calls to native actions. 

An action can further be decomposed into a combination of actions, transformations and conditional logic.


Creating an Azure Logic App


Next we will demonstrate an example of creating a basic Logic App to send an email notification whenever a new item appears in the distinct RSS feed. You can use any RSS such as 
  • BBC world news - http://feeds.bbci.co.uk/news/world/rss.xml
  • CBN world news - http://www.cbn.com/cbnnews/world/feed/


This example will validate the concept of setting up a connector and a basic workflow with simple rules to decide on what to do when a trigger occurs.

Pre-requisites


  • You need an email account from a provider that's supported by Logic Apps, such as Office 365 Outlook, Outlook.com, or Gmail, etc. I will go ahead with my personal Gmail account.
  • Azure subscription, if you don't have an account then sign up for a free Azure account - https://azure.microsoft.com/en-gb/free/
  • Any valid RSS feed link(s)



STEP - 1: Connect to Azure Account


Login to the Azure portal https://portal.azure.com/

Click ‘+ Create a resource’ or click ‘All services’ from the left hand menu, enter Logic apps in the appeared search section and hit enter.

Also from the main Azure menu, you can choose Create a resource > Integration > Logic App.


STEP - 2: Create Logic App


Under the Create section, provide property details about your logic app as shown here – 
  • Name - The name of your logic app.
  • Subscription - The name of your Azure subscription, it would be either free, paid or specific subscription etc. 
  • Resource Group - The name for the resource group used to organize related resources, you can either create a new resource or choose an existing one.
  • Location - The region where to store your logic app information.
  • Log Analytics - Keep the setting for diagnostic logging Off.



STEP - 3: Deployment


Azure starts the deployment of this newly selected resource as soon as you click the ‘Create’ button, and very soon you will get deployment completion acknowledgement.


STEP - 4: Logic App Designer


Next, select the newly created logic app resource and click ‘Logic app designer’ under ‘Development Tools’ section.


It will load Logic App Designer section –


STEP - 5: Blank Logic App


Here either you can pick one of the most commonly used triggers or go ahead to select the Blank Logic App for custom requirements.


Since we need to go with an RSS feed, so click the Blank Logic App. It will load a new Logic Apps Designer section where you can get all types of connectors and triggers.


STEP - 6: Select Trigger


Click the RSS and select the listed trigger ‘When a feed item is published’ from the new section – 


Fill all required details such as RSS feed URL, interval and frequency etc.



STEP - 7: Define Steps


Post filling all parameters, click the ‘New step’ to choose an action. Here we can select any email action, will go to Gmail.


Click the Send email action- 


STEP - 8: Map Connection


Next required to sign in to create a connection to Gmail.



Post click of sign in, provide the precise details such as body, email id etc. and save it as well run the same.


Post manually starting your logic app, if the RSS feed has new items, your logic app sends an email for each new item. Along with, you can schedule the logic app to check the RSS feed based on minutes/hours etc.

For example, I received a lot acknowledgement about new RSS feed.


Here is a sample email that this logic app sends based on selected body and subjects, if you don't get any emails then check the spam folder.


Congratulations, Azure Logic App example done!!😊


No comments:

Post a Comment