Microsoft Azure |Automate Common Tasks With Azure Logic Apps.

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 175 different connectors. Since the Logic Apps are server less, we do not need to worry about server sizing. The platform will scale to meet our demand, and we are only charged for what we use.

Azure Logic Apps are hosted in Microsoft Azure, and so, there’s no infrastructure component, there’s no on-premises or virtual machines to manage. On that basis, and in terms of how we pay for it, it is essentially server-less.

Logic App can be trigger launched, and there is no server configuration involved for us as developers or managers of these Logic Apps. It is also server-less in the pricing sense, in that it is paid for in terms of how many actions our Logic Apps take.

Logic apps have a no code designer for rapid application creation.  It will give us an easy way, without writing code, to do integration in the cloud and automate it.  No need to go through hours or days to get setup.   With a simple user interface, it should help us to get started in a matter of minutes.  This simplification should help broaden the user base and make more people willing to use Azure.

How Logic App Works:

logic apps starts with a trigger whenever specific criteria meets or any event happened.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.

Benefit’s of Logic Apps:

  • Visually build workflows with easy-to-use tools.
  • Get started faster with logic app templates.
  • Connect disparate systems across different environments.
  • First-class support for enterprise integration and B2B scenarios.
  • Write once, reuse often.
  • Pay only for what we use.

Let’s take simple example with Microsoft one drive. Assume there is specific folder created on one drive and allow to upload different files like xml, json,word, ppt etc.Folder owner is more interested in specific files format not all files and want some notifications when ever specific file uploaded in one drive folder.

In above use case one drive and email client integration required and this problem can be solved by any programming techniques but required more configuration and development expertise But logic apps doesn’t required much expertise all of that.there are hundred’s of connector’s available to integrate with external tools.

Get Started:

Login on azure portal and select logic apps service under enterprise integration category.

L2.jpg

L8.jpg

There are so many templates available to start designing logic apps and select as per business requirement.select blank template for custom designing , here we will go with blank template.

L9.jpg

Once we create logic app than go to logic app designer and start designing the business workflows.

L3.jpg

Now start adding connectors as per the business requirement.Here we will select Microsoft one drive connector as staring point of logic app workflow.

To do so,click on “New Step” button and add new action,after that we will see a list of connectors.

L4.jpg

here is a list of connectors,we will search for Microsoft one drive to make connection with one drive.

L5.jpg

L6.jpg

Every connector has two type of options like trigger and actions.Trigger always be staring point of workflows and responding back on specific events on resources. In our case we are going to monitor our one drive folder.

L7.jpg

once we added one drive connector than we have to connect with valid credentials,here we have to use our Microsoft user id & password for one drive authentication.

L10.jpg

once we clicked on sign in button,we will redirect to Microsoft login page for login.

L11.jpg

Once we authenticate successfully then we are able to see all folder’s on one drive.Select any folder on which monitoring required,here i go with “Azure Testing Files” because all files uploaded in this folder.

L12.jpg

L13.jpg

Now add next step,Click on + sign and add conditional action.

L14.jpg

Conditions are similar to C# or any other language “if-Else” statements.

L15.jpg

First we have to define condition by taking input parameter’s from previous step which is one drive connector.we have to check uploaded file extension whether file is xml file or not.

L16.jpg

If above condition match than  write send mail functioanlity to notifying about uploaded xml file.Here we can see send mail logic defined inside the true condition with Gmail connector .

L17.jpg

Now we have to define some action for false condition,if conditional statement not matched with uploaded file.In this case we only monitor xml files.so if any other files uploaded than logic apps move such files from main folder to archive folder.

Let’s take one drive connector in false condition section and write  file archive logic,have a look complete file archival logic.

L19.jpg

Now we ready with folder monitoring workflow with logic app,let’s look complete designed logic app.

L20

Trigger the logic App:

To test the logic app,I have set the time frame as 10 second to trigger the logic apps that means in every 10 second one drive connector scan the one drive folder if any new file uploaded inside the folder,it automatically triggered and start executing complete workflow.

below is snapshot from one drive that contains two folders. One folder (“Azure Testing Files”) is used for uploading files and another folder (Archive Azure Testing) used for archive files.

L21.jpg

Verify True Condition,if Xml file uploaded then mail should send:

As of now both folder are empty.Now upload any xml file in “Azure Testing file” and we will see  logic app automatically trigger and detect this file and start executing all connectors. As per our condition file is xml than true section should execute and send mails to folder owner. Let’s catch-all events.

uploaded xml file to one drive folder.

L22.jpg

Now go to logic apps and see activity logs.

L23.jpg

if we open above highlighted details then visual designer pane will open with all connector execution status. here we can see each connector status in dept.

L24.jpg

As Gmail connector executed successfully then Gmail should send mail to folder owner.Below is received mail which is sent by logic app.

L25

Verify False Condition: If uploaded file is not xml file,then false block triggered.

Let’s upload other file format files (other than xml files) then true block will not execute and not send any email by Gmail connector.In this case false block will triggered and move file from uploaded folder to archive folder by one drive connector.

This time image file uploaded.

L26.jpg

See logic app execution details.

L27.jpg

After successfuly execution we can se uploaded file moved to archive folder from uploaded folder.

L28.jpg

Conclusion

Logic apps are not only about integration and orchestration, but also about connectivity to other services. These services can be Azure based, SAP applications or 3rd party solutions such as One-Drive and Dropbox: They can even be custom-built applications running on-premises, such as a web API.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s