Does the thought of automating workflows seamlessly between the cloud and on-premises environments sound like an impossible dream? Azure Logic Apps can not only do this, it can do it easily. And the real beauty of Azure Logic Apps is that it does not require you to develop code to take advantage of this automation and integration.
The main benefit for the IT pro is that without knowing a lot of Visual Studio/code (although a developer can take advantage of using Visual Studio tools), we can use a simple and easy-to-use interface in a web browser to create a workflow. In that workflow we can have managed connectors that allow us to consume data from different sources, and from that point we can have a trigger event, which results in an action to perform a specific operation.
There are several connectors available, and we can develop our own integration to use as a connector. We can even share that on the marketplace and get something out of it.
We can also take advantage of on-premises data by installing data gateway for Azure Logic Apps, where this feature will be able to read data from several on-premises sources, such as Biz Talk 2016, DB2, SharePoint, SQL Server, SAP, File System, and several more.
In this article, we are going to create a simple Logic App to demonstrate how the solution works, and after going through the process to create it, we will check some features to help the troubleshooting the feature. Specifically, our Azure Logic App will read any new RSS entry from a website and publish it dynamically on Twitter.
Azure Logic Apps is dynamic, and there are always newly managed connectors being added. Make sure that for each integration, you understand the connector and use your imagination to create the logic. The rule of thumb here is that if you are looking for something simple, then the Azure Logic App Designer should suffice. However for more serious workflows that require input of files, then Visual Studio and knowledge of JSON would be important.
Creating Azure Logic Apps
The creation process is done using the Azure Portal. Click on New, type in logic and select Logic App (Microsoft is the Publisher) from the list. A new page with a brief overview of the feature will be displayed. Just click on Create.
In the new blade, define a name (we will use Infralab), subscription, and for the sake of organization, we will create a resource group just for this feature. After that we can define the location and if there is integration with OMS (Log Analytics). Click on Create.
Now that the Resource Group and the first Azure Logic App have been created, we will be able to see it on the Overview page of the Resource group.
Building the first Azure Logic App
Any new Azure Logic App starts blank. On the main page on Azure Portal, we have the option to start with a common trigger (as depicted in the image below), or a template, which has a trigger and an action (HTTP Request-Response, send an email when an item is modified in SharePoint, to mention a few).
We are going to start with a blank Logic App. On the new page we will type in the first bit of information that will start our workflow. Based on our idea, we will first retrieve new information from RSS. In that case, let’s type RSS and as we can see on the image below, we do have a Trigger for that. Before clicking on it, let’s pay attention to the Triggers and Actions available for what we are looking to do.
In our scenario, we are looking for a trigger when a new feed pops up. Select Triggers and click on RSS.
A new box with the trigger that we have just selected will show up on the Logic App Designer. Let’s confirm the location of the feed and the frequency to check new content.
After the new box, we have the New Step, and we can decide between Add an action or Add a condition, which gives great flexibility to manage the workflow. If we click … More , we have advanced options, such as: switch case, for each, do until and add a scope. This helps even more on controlling the workflow. (Keep in mind that we are not touching code at this point.)
We are going to click on Add an action, type in Twitter, and from the list select Post a Tweet from the Action section. Since we have not used the Twitter Managed Connector so far, a sign-in page will be required. Click on Sign in , and we will be redirected to the Twitter page where we need to enter authentication and authorize the Azure Logic Apps to work with Twitter.
Now that the connection was established, we can start typing in what we want to tweet. But we want to be dynamic, right? Not a problem! We can add parameters from the previous step — in our case from the RSS that we retrieved we can create a tweet with the title and link, so just pick from the list below.
After that, click on Save, and then click on Run. After that create a new entry on the portal to generate a new RSS feed and wait a few moments.
When running the new workflow on Logic App Designer and the workflow is triggered (in our case due to a new RSS entry), we can check what happened including requests/information used on the workflow, and that helps us to understand and debug the entire process.
If we go deeper, we can see the entire body of the message retrieved. That helps us to build conditions and to analyze the data that is being received during the trigger process and produce better workflows.
As you could expect, the result was a new Twitter on my account (Post #05), as depicted in the image below.
Some hints about Azure Logic Apps
On each integration that you create with Azure Logic Apps, the connector will require additional information where you want to connect to exchange information, and it will require some research for any new component that you add to your workflow.
There are a few hints that I would like to share to help you when building your first Logic App workflows.
The first hint is the Overview tab at the Logic App level. It will list all the Runs History and Trigger History of the Logic App. That helps a lot during troubleshooting. On the same location, we can enable/disable the Logic App. It also provides summaries about the Logic App and how many times it ran.
If you want to play with the code, you can click on Logic App Code View and the code will be listed on the right side, which allows editions. It is great for small changes on the code.
Another nice feature is the API Connections, which lists all current APIs in use on the current Logic App.
There you have it. You have created your first Azure Logic App. Now it’s up to you — and your imagination — to take this tool even further.
Photo credit: Shutterstock