Serengeti logo BLACK white bg w slogan
Menu
Serengeti logo GREEN w slogan
Menu

Running Tasks on a Scheduled Basis Using the Azure "Logic Apps" Service

Zoran Bošnjak, Software engineer (.NET / React)
10.03.2021.

Azure Logic Apps is an interesting cloud service that provides you with features to schedule and/or automate tasks, business processes, and workflows when you need to integrate data and services across enterprises or organizations. Logic Apps simplifies how you design and build products for application or data integration, whether in the cloud, on-premises, or both.

Some of the examples of the processes you can manage with Logic Apps are:

  • Send email notifications
  • Send SMS messages
  • Delete specific rows from SQL databases
  • Upload files from FTP to Azure Storage
  • Monitor Twitter tweets for a specific subject
  • Run specific Web API endpoint

Overall, there are hundreds of different connectors available in the Logic Apps service, and although some are more complex than others, they are all easy to use through a user-friendly interface.

Each logic app workflow starts with a trigger (that will fire when a specific event/action happens). When the trigger is executed, one or more actions assigned for the trigger and created in the workflow are called.

In the example that follows, we will be using a Recurrence trigger – which allows actions to be executed on a scheduled basis – to execute our publicly available API endpoint every 6 hours. That is just one of many possibilities of using Logic Apps, and it’s not complicated to implement.

Some of the scenarios for using the Recurrence trigger are:

  • Daily database backups
  • Cleaning database logs
  • Collecting data from a resource
  • Employee notifications

and many others. 


Note that scheduled jobs can be fine-tuned for a run at specific dates, specific times, at specific intervals (such as every 15 minutes), etc.


We can then provide a specific business logic in API that we call from the scheduler, for example, check for expired data on our database, send an email to employees, or anything else. 

Without Logic Apps, it would be very hard to run a specific endpoint (and code in it) at a specific time or time intervals.

We can also monitor, restart, stop or look at logs of our Logic App, and therefore always have control over it.

The Process of Creating a New Logic App

Open Azure Portal (portal.azure.com) and type “logic apps” in the search field. Click on the “Logic Apps” menu item (in the Services section).

logic apps menu
Logic Apps menu

In the Logic Apps List (it will be empty by default, as you probably don't have any logic apps created), click on the "Add" and then "Consumption"

logic apps list
Logic Apps list

In the Logic Apps Creation window, select your Subscription and Resource Group (if they are not already set by default), and give your Logic App some descriptive name (like TestAppScheduler). Leave everything else as default (unchecked), then click on the "Review + create" button (it will take a couple of seconds), and after that click again on the "Create" button.

logic apps creation window
Logic Apps Creation window

This process will take some time (usually about 15-30 seconds), but upon successful creation of the Logic App, you will see windows similar to this:

screen upon successful creation of the logic app
Screen upon successful creation of the Logic App

The most common Logic App triggers are shown in the window, but we need a trigger named "Recurrence" (which will run our API endpoint every 6 hours). So, go ahead and click on a button named "Recurrence".

The next step is the actual process of creating and fine-tuning our Recurrence Logic App, so set a value to "6" for the Interval, and "Hour" for the Frequency. Click on a "New Step" button afterward.

fine tuning of recurence logic app
Fine tuning of Recurrence Logic App

On the Operation chooser window, among hundreds of different connectors find the "HTTP" (without the swagger file) and click on it. You will be presented with a window very similar to this:

http on the operation chooser window
HTTP on the Operation Chooser window

On the HTTP configuration set Method to "GET" (if your API endpoint is set up to work with HTTP GET verb), and URI to the full location of your API Endpoint (including the HTTPS prefix). Leave everything else as default (blank values).

http configuration set
HTTP configuration set

Note, In this window you can also set up API Authentication (using various authentication types like Basic or Bearer) if your API is enforced with it.


After clicking on the "Save" button, your Logic App will be successfully created and ready to run!

After the Logic App has been created, you will automatically be redirected to the list of all created Logic Apps, where you can manage them.

If you click on your Logic App, the window will appear presenting you with various information about App Runs, Triggers, and Metrics. The most interesting one is the Start time, the duration of an HTTP response, and status (success or failure).

various information about app runs triggers and metrics
Various information about App Runs, Triggers, and Metrics

By clicking on each event, you can view the detailed result of an HTTP request, including its response.

detailed result of an http request
Detailed result of an HTTP request

As stated before, this is just one of the numerous examples of using Azure Logic Apps. There are countless more connectors available and corresponding strategies available with them. We are here to help, so feel free to reach us.

Let's do business

Projekt je sufinancirala Europska unija iz Europskog fonda za regionalni razvoj. Sadržaj emitiranog materijala isključiva je odgovornost tvrtke Serengeti d.o.o.
cross