AZ-303 Microsoft Azure Architect Technologies – Implement Solutions for Apps (10-15%) Part 10
- Azure Logic Apps Introduction
In the next few lectures, we’re going to look at logic apps. Logic apps are a server less offering by Azure. Logic apps help you build solutions that integrate apps, data, systems and services across enterprises or organizations by automating tasks and business processes as workflows. Logic Apps is a cloud service in Azure that simplifies how we design and create these scalable solution, whether in the cloud, on premises, or both.
Some of the benefits of Azure logic apps are you can get started very quickly using templates. It’s quite possible to build complex workflows without writing any code whatsoever. You can save time by designing complex processes using easy to understand design tools, either using Visual Studio or even within the Azure Portal itself. You can then customize your logic app further with your own custom APIs code and actions.
You can also connect and synchronize completely different systems across on premises and the cloud with a whole range of built in connectors and actions. Logic Apps is basically a fully managed iPad or integration platform as a service which frees you from worrying about the underlying hardware, scalability, availability, or management.
Logic apps will therefore scale up automatically to meet demand as and when you need every logic app workflow starts with a trigger, which fires when a specific event happens or when new available data meets specific criteria. Many triggers include basic scheduling capabilities so that you can specify how regularly your workloads run. For more custom scheduling scenarios, you can start your workflows with a schedule trigger.
Each time the trigger fires, the logic app engine creates a logic app instance that runs the workflow’s actions. These actions can also include data conversions, floor control such as conditional statements, switch statements, loops, and branching. For example, a logic app can start with a dynamic 365 trigger with a builtin criteria, when is a record updated and if the trigger detects an event that matches the criteria it fires and when runs the workflow’s actions.
You can choose from a growing gallery of over 200 different connectors, including other Azure services such as Service, Bus, Function Storage, SQL, Office, 365 Dynamics, Bistrol Salesforce, SAP, Oracle, DB and more. These connectors provide the triggers and actions creating logic apps that securely access and process this data in real time. Connectors play an integral part when you are creating these automated workflows. By using the connectors in your apps, you expand the capabilities for your on premise and cloud apps platforms to perform tasks with the data that you’ve already created. Connectors are therefore available as either built in or managed connectors.
Built in connectors are built in actions and triggers that help you create logic apps that run on custom schedules and communicate with other endpoints. Managed connectors provide triggers and actions practicing of the service and systems. But some connectors require that you first create connections that are managed by the Azure logic apps. These managed connectors are organized into different groups. Managed API Connectors these create logic apps that can use services such as Azure Blob, Storage, Office 365, and so on.
On Premise Connectors You can install and set up on premise data gateways, and these connectors help your logic apps access on premise systems such as SQL Server, SharePoint, Oracle, DB, or even File shares. Integration account connectors are available when you create and pay for an integration account. These connectors transform and validate XML, encode and decode flat files, and process business messages. Finally, there’s a series of enterprise connectors which can provide access to enterprise systems such as SAP and Ibmq.
Each connector offers a set of operations classified as actions and triggers. Once you connect the underlying service, these operations can be easily leveraged within your apps, and workflows actions are changes direct by user. So, for example, you would use an action to look up, write, update, or delete data in the SQL database.
All actions map directly to operations defined within a Swagger configuration. Several connectors provide triggers that cannot fire when specific events occur. For example, the FTP connector has the onupdated file trigger. You can build either a logic app or flow that listens to this trigger and performs an action whenever the trigger fires. There are two types of trigger polling triggers. These triggers call your services a specified frequency to check for new data, and when new data is available, it causes a new one of your workflow instance with the data as input.
Push triggers listen for data on an endpoint that is, they wait for that event to occur. The occurrence of this event will cause a new run of your workflow instance. To get a better understanding of how what logic apps work, let’s go ahead and create one.
- Azure Logic Apps via Portal Walkthrough
We can create logic apps either through the portal or through Visual Studio. First we’ll go and create one through the portal as always go to create a resource, search for logic and choose logic app and click Create. We’re going to create new resource group as usual and we’ll give it to names. This. I will call it cloud Guru portal app. Going to choose UK South as the location and I’m going to turn off log analytics and then we just go review and create and then create. Once that’s complete, we can go to the resource and by default it will bring up the logic apps designer. So all we’ve basically done is created a logic app container that will contain our actual apps and workflows that might run. We can actually start with a number of common triggers and plugins.
So as we can see here, there’s plugins for Outlook, OneDrive FTP, event grid and so on. And this is really where all the power from logic apps come from. It makes it really easy to again hook into the services with zero code if need be. We’ve also got a wider range of templates down here that you can search through if there’s anything you want. And again, it’s handy to have a look through these. See even it’s just an idea of some of the things that you can do. What we’re going to do is start with a blank app first of all. And the first thing we need to do is create a trigger. So I’m going to go to all and I’m going to do a search.
What I’m going to do is create a trigger so that every time I post a new post through my blog, it’s going to send me an email. So the first thing I want to do is search for a trigger for RSS. And here we are. So we’ll have an RSS item feed. Click on it and it will ask us for some basic information. So I’m going to put in the feed address for my blog, which is httpscompletcloud guru feed. And I’m going to tell it to check for new items once a day and click Next new step. So once we’ve got our step, we need to do something or some sort of action when an item is published.
So what I want to do is send an email. So if I do a search for mail, we can see here that we have got lots of different connectors for mails including Outlook. com, Office, three, six, five, Gmail and so on. What I’m going to do is I’m going to make this send an email from my Outlook account. So I select the account, scroll down the list until I find what I’m looking for, which is send an email. And the first thing it wants to do is for me to sign in and approve the access throughout lock. com. So that’s what I shall do.
Now say yes, that’s now connected my outlook. com to that. What I’m going to do is I’m going to tell it who I want to send the email address. So I’m going to send it to a different account of mine. We’re going to specify a subject. And what I want to do is actually putting the title of my subject. So you can see up here we’ve got this dynamic content option appearing. And if we have a look through, because it’s a feed, feeds always follow set rules or set tags you can have.
So let’s have the feed title and then in the email body again, let’s put in the feed tag. Sometimes these disappear here. If they do, we can just do a search. I’m going to do a search for title. And again we’ve got feed title. What I also want to do is a link. So we want the primary link feed and once that’s in, click away to close all that down. And I’m just going to click save and that’s it.
With that in place, every time I enter a new blog entry, this will notify this feed and it will automatically send me an email. We go back to the logic app here. We can also look at the logic app code view because all apps are essentially JSON defined in the background. We can go and actually look at the full definition here and from there we can download that. We can run it directly if we want to test it and so on. In the next lecture, we’ll do the exact same again, except we’ll do it within Visual Studio.
- Azure Logic Apps via Visual Studio Walkthrough
So in the last lecture, we created a logic app using the portal. This time we’re going to do the same in Visual Studio 2019. 1st thing we want to do is go and create a project. Now this isn’t quite as straightforward as you would expect when we’re doing logic apps. What we actually have to do is create an Azure Resource Group first. So do a search and look for Azure Resource Group and click Next. Let’s give it a name and click Create. This will now bring up a list of Visual Studio templates. And as you can see here, there’s actually lots of different things that we can use Visual Studio to create. The one we’re after is Logic app. So here we have the JSON definition files that determine how these services get built. Now these are all Arm templates and we could manage them directly.
But actually what I want to do is use a Gui. And if we right click on there, there’s no option to open it with anything. So what we need to do is install the logic apps extensions within Visual Studio, go to the Extensions menu and manage extensions in the search, perform a search for logic. And we want the Azure Logic apps. Tools for Visual Studio. So go ahead and click Download. Once that’s downloaded, what you actually need to do is close down Visual Studio in order for it to install the extension and then wait for the extension installer to appear, modify.
Once that’s completed, go back and relaunch Visual Studio and open up the app that we created earlier. Now with the extension installed, we can right click the logiccap JSON and now we get a new option which is open with Logic App designer. It will ask us for a resource group. So I’m going to go and use the one we created earlier. The location you can either choose a lock is from here or I’m just going to say same as Resource group and click OK. So the view here is actually very similar to the one that we had in the portal.
And in fact, we’re going to go through the exact same process. So I’m going to say a blank logic app. I’m going to take an RSS feed, going to go to complete Cloud guru interval of once a day. If we want to have parameters, we can do so here. But we’re not using those for this one. And I’m going to click next step again. I’m going to go and send an email, use Outlook. com, send an email subject again. We’re going to use the feed title and in the body for this one, I’m actually just going to enter the primary feed link. Then once that’s all done, going to save that and close it down.
Now if we open this backup again, not with the app designer, but just open it normally we get the JSON file again. And in here we have all the details that we’ve basically just configured by using that UI designer. So the final step once we’re happy with that is to right click, say Deploy, and I’m going to deploy to RSG logic Apps, which is our resource group, and then click Deploy. If it’s missing any parameters, it will come up to ask. So I’m just going to call this same as what we called project. What this actually does is launches PowerShell and runs a series of scripts that will connect to your subscription and deploy the logic app.
Once that’s successfully deployed, we can go to our portal. So logic apps not automatically in these lists. So if we go to more services and just do a search for logic and logic apps and we can see our existing portal up there and our new logic app there that we displayed Visual Studio. And in here again, we can see all the details as we saw before. And in fact, we can even go into the logic app design within the portal. And if need be, we could even modify the design through here. Two very easy methods of creating logic apps. And in fact, you can switch and choose between the two as you need.