ArrowLinkToArchivePageBlog

Serverless Services Introduction Enterprise-scale process in one day


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 the 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 are Azure Logic Apps, and Azure Functions, where can we use them, and how much will they cost?

KEY POINTS:

  • What are Azure Logic Apps and Azure functions?
  • How can you use it in your company?
  • How much does it cost?
  • Is Serverless worth using?

Definitions

Firstly, let’s clarify some of the terms in order to understand what we are going to talk about.

Serverless

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.

Azure Functions

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.

Azure Logic Apps

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”?

Azure Logic Apps and its 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.

diy with Azure Logic Apps

Do it yourself

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

Azure Logic Apps details and list of invocations

Our case study

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.

Workflow built in Azure Logic Apps

Our workflow built in Azure Logic Apps

We used the following connectors:

  1. SharePoint – create, read, update and delete (CRUD) operations in SharePoint Online lists.
  2. 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 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.

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 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.

Summary

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.

KEY TAKEAWAYS:

  1. Azure Function – service for running our code
  2. Azure Logic Apps – service for orchestrating our workflows
  3. Serverless is not bad if you are aware of its specs
  4. Not every app can be rewritten to be able to use serverless architecture
  5. Using Azure Logic Apps saves time, while Azure Functions saves money

Sign up for Predica Newsletter

A weekly, ad-free newsletter that helps cutomer stay in the know. Take a look.

SHARE

Want more updates like this? Join thousands of specialists who already follow our newsletter.