Let’s change it!
Today, I will answer the question: What are Azure Logic Apps, and Azure Functions, where can we use them, and how much will they cost?
Firstly, let’s clarify some of the terms in order to understand what we are going to talk about.
Serverless definition – according to Martin Fowler the authority of the IT world – is a type of application triggered by events in stateless containers, fully managed by a service provider. I am convinced, that it’s something more, than just a hosting service. Microsoft Azure offers at least a few serverless services, like Azure Logic Apps and Azure Functions, which are the main topic of today’s post.
In a nutshell, Azure Functions is a Function-as-a-Service (FaaS). We write some lines of code which later we deploy to Azure Functions. After that, we can trigger our function by events like HTTP requests or a new message in the queue or Azure Storage.
Moreover, we can add a new custom trigger. That subject was described by Yuka Abuno – Microsoft MVP on her blog. Azure Functions can execute C# and JavaScripts code (general availability). All currently supported programming languages you can check in the official documentation.
One of the best examples of Azure Functions usage is integration with external systems.
What do these Azure functions do? They are short pieces of code that can initiate our apps. The next benefit of this technology is its pricing – the first million invocations are for free, and every next costs about 0.17 EUR (pricing at 15 August 2018). Azure Functions are also offered with App Service Plan, where we are billed for App Service Plan instead.
It is one of the serverless services for creating workflows through a visual designer. Usually, it is the core of the serverless solution. This service is similar to SaaS services like Zapier or IFTTT. “Coding” Azure Logic Apps is really easy. You only need to choose „bricks” and connect them in order to match your logic.
That’s all!
But what are these mysterious „bricks”?
„Bricks” are actions of connectors, which gives us the possibility to integrate with external services. Currently, we have more than 100 available connectors (managed APIs).
A number of them are getting higher and higher though. Official documentation of these connectors is available on the Microsoft site.
But there is a catch.
Unfortunately, we will not always find a connector that meets our expectations. That’s why we can call our service/API via HTTP request or write a custom code, launched as – like mentioned above – Azure Functions.
When we have all the „bricks” prepared, it’s time to build our app!
Azure Logic Apps can be created through a visual designer in Azure Portal or Visual Studio. It can be also edited via a text editor if stored as a JSON file. Standard „bricks” can stick to different logic bricks like loops, switches, conditions, and even more.
Moreover, we can execute loops in parallel mode and define retry policies in case of execution failures (e.g. unsuccessful HTTP response status code). The next great benefit is built-in logging. It’s really easy to check which invocation was successful and which was not. This mechanism logs the input, output, and duration of steps of the workflow.
Azure Logic Apps details and list of invocations
One of the solutions we built at Predica is the synchronization of Office 365 user calendars with SharePoint Online. We built it using ONLY the out-of-the-box Azure Logic Apps connector. No code!
That’s not all!
We didn’t need to spend time on creating a new project, compiling it, and building the entire CI/CD process. We spent time creating the logic of this workflow. This is one of the most important advantages of Azure Logic Apps – keeping focused on the business goal, not the way of achieving it.
Our workflow built in Azure Logic Apps
We used the following connectors:
As you see, it’s not so difficult.
The question is: Do we save money on hosting whereas we don’t pay for the coding part?
It depends.
If we decide to use Azure Logic Apps we are going to have much higher hosting expenses but a lot of funds are going to be saved when it comes to workflow creation.
On the other hand, if we code on our own, we save money on Azure Functions hosting but the costs of the development phase are going to be higher this time.
So what is the real story between the operational cost of Azure Functions and Azure Logic Apps?
We will compare the cost of million invocations of these both technologies (skipping the first free invocation). Each million Azure Functions invocations costs 0.17 EUR – assuming that each one lasts one second, while one million Azure Logic Apps costs 21 EUR.
Serverless is an incredibly interesting concept, but it may also bring us lots of unexpected problems. These services use a shared environment, so they may be stopped after a short time of inactivity (it doesn’t apply to Azure Functions hosted App Service Plan).
As a result of that, the latency requests may vary significantly. Later, we cannot predict whether our process is up and running, or is just starting (cold start).
While building a serverless solution using Azure Functions or Azure Logic Apps we assemble a distributed solution. In that case, you need to know that distributed programming problems may appear.
As a consequence, debugging your solution will no longer be a piece of cake, so you need to prepare detailed logging.
Another issue – it could be either disadvantage or advantage though – is the need of implementing the CI/CD process. The more Azure Functions you code, the more of them you have to deploy. You certainly know how time-consuming activity it is, so creating the deployment process is totally a MUST HAVE.
Serverless services in Microsoft Azure are quite new offerings. Azure Logic Apps and Azure Function are two of three globally available serverless services in Microsoft Azure, but they are most frequently used.
If you can accept a risk they are associated with, you can solve tons of problems and automate your employees’ daily tasks.
Are you still hungry for knowledge? You can expect more about serverless with the use of Azure Event Grid soon. Follow me on LinkedIn to be up to date.
Read other similar articles