When we browse the internet, more and more often we see “serverless services” â€“ the buzzword of the year 2018. We read about it on the internet and listen to it during IT conferences.Â Unfortunately, we hear about cases that come from official cloud providerâ€™s documentation, not the real ones â€“ these that we could use when building our own solution.
Letâ€™s change it!
Today, I will answer the question: What is Azure Logic Apps, Azure Functions where can we use it and how much will it 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 IT worldâ€™s â€“ is a type of application triggered by events in stateless containers, fully managed by service provider. I am convinced, that itâ€™s something more, than just 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 request or a new message in the queue or Azure Storage.
One of the best examples of the Azure Functions usage is integration with external systems.
What these Azure functions do? They are short pieces of code which can initiate our apps. Next benefit of this technology is its pricing â€“ first million of invocations is for free, 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.
Azure Logic Apps
It is one of the serverless services for creating workflows through a visual designer. Usually, it is a 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.
But what are these mysterious â€žbricksâ€ť?
â€žBricksâ€ť are actions of connectors, which gives us a possibility to integrate with external services. Currently, we have more than 100 available connectors (managed APIs).
A number of them is getting higher and higher though. Official documentation of these connectors is available on Microsoft site.
But there is a catch.
Unfortunately, we will not always find a connector which 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.
Do it yourself
When we have all â€ž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). Â Next great benefit is built-in logging. Itâ€™s really easy to check which invocation was successful and which not. This mechanism logs the input, output, and duration of steps of the workflow.
Azure Logic Apps details and list of invocations
Our case study
One of the solutions we built at Predica is 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, building 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:
- SharePoint â€“ create, read, update and delete (CRUD) operations in SharePoint Online lists.
- HTTP â€“ Microsoft Graph API requests authenticated with OAuth2.0 â€“ getting access token is already implemented in the connector. Wow!
As you see, itâ€™s not so difficult.
The question is: Do we save money on hosting whereas we donâ€™t pay for coding part?
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 costs of 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 first free invocation). Each million of Azure Functions invocations costsÂ 0.17 EUR â€“ assuming that each one lasts one second, while one million of Azure Logic Apps costs 21 EUR.
Server(less) threats â€“ the other side of the coin
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 the 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 need of implementing 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.