workflow migration
Office 365 Calendar
Azure Serverless
Dynamics365
Office 365
Selenium Test automation
Records Management SharePoint
Critical Path method
DevOps
1 2 21

Cloud computing has evolved over the last decade. It started with cloud providers offering data centers to organizations as an outsourced storage mechanism. It turned into Infrastructure as a Service (IaaS) where consumers had more control as they managed the servers or virtual machines. Just like any technology, cloud computing kept becoming more convenient for consumers, as Platform as a Service (PaaS) became more popular. All that the development teams needed to worry about was their applications, and the infrastructure was handled by the cloud provider. In the last couple of years, the abstraction went to another level. With serverless computing, or Functions as a Service (FaaS), the focus shifted from an application down to a function. You code a function and let the cloud provider manage its execution.

Azure offers multiple services using which you can build serverless architectures. Some of them include Functions, Logic Apps, and Event Grid. In this article, we shall touch upon Azure Functions. Before diving deep into it, let’s first understand the concept of Serverless Computing.

What is Serverless Computing?

First things first, serverless computing does not mean that servers are out of the picture. Servers are very much required, just like they have been for all these years, or else, where will your code run. The reason why the phrase was coined is that as a developer, you do not need to worry about what server your code runs on. In fact, you do not know which server it eventually runs on. Once your code is deployed, Azure assigns the responsibility of executing the code to the next available server. What Azure ensures, and what is ultimately important for you, is that your code will execute whenever required.

Serverless computing is essentially an abstraction of servers, infrastructure and operating systems. It makes your code infrastructure-agnostic. As a developer, infrastructure is usually the last thing to worry about. Azure Serverless also keeps the sponsors of the application happy as it charges for what you use.

What is Azure Functions service?

As the name suggests, Azure Functions service allows you to deploy small pieces of code on Azure. Till a few years back, deployments were done at the application level. With the advent of microservices architecture, functionalities of an application started getting deployed as independent microservices. Using Azure Functions, you can go one step further, and deploy a function that performs one specific and critical task. The benefit of doing so is that you can have only the function scaled up when needed instead of scaling up the entire microservice or application. As an example, a retail website team can deploy a function that does a simple task – send alert messages. On a Black Friday, the function will be scaled up to accommodate thousands of users. In a way, Azure Functions can also be called as “nanoservices”.

For a developer, not having to manage the infrastructure is not the only benefit that Azure Functions brings to the table. It allows you to code in the language of your choice. It not only supports C# but also Java, PHP and Python among others. Moreover, it’s completely open-source and the source code is available on GitHub. As you deploy small pieces of code, it is obvious that those pieces need to integrate with other parts of an application. Azure Functions integrates with multiple Azure services that include Cosmos DB, Event Hubs, Event Grid, Storage, Notification Hubs, Service Bus and even on-premises applications.

How to develop Azure Functions?

  1. Login to Azure Portal. Create a new Function App (Compute -> Function).
  2. Choose a trigger (that triggers the execution of the function) from the options:
    • HTTP
    • Timer
    • Blob
    • Queue
    • Event Hub
    • Service Bus
    • Custom trigger
  3. Choose a language (C#, F#, Node.js, Java or PHP).
  4. Code your function (keep it short and sweet, just like any well-written function).
  5. Add I/O Bindings (to connect to data sources).
  6. Test the function, of course.

As an alternate, you could develop and publish a function from Visual Studio too.

What are my options to host Azure Functions?

There are two ways Azure Functions can be hosted on Azure.

  1. Consumption Plan
    • Truly serverless, resources are not reserved
    • Automatically allocates compute power depending on load
    • Recommended option if you want high scalability
  2. App Service Plan
    • Dedicated VMs run functions like Web App services
    • Recommended option if you have underutilized resources to exhaust
    • Go for it if your function runs for a long time or needs high CPU or memory

What are the use cases of Azure Functions?

Any small functionality that needs to be executed – on demand, or driven by an event, or on a scheduled basis – and is expected to be scaled up and down depending on load is a great candidate to be developed using Azure Functions service.

  1. Any high-volume transactions that need to be scaled, like order processing, etc.
  2. Threshold alerts in remote monitoring solutions
  3. Executing steps in workflows driven by Logic Apps
  4. Executing scheduled tasks
  5. Event-driven processing of documents, files or messages
  6. Responding to events in GitHub repositories
  7. Text/email acknowledgements

 

We recently hosted a webinar titled “Azure Serverless with Functions, Logic Apps and Event Grid”, where I discussed how quickly you can build and deploy cloud-scale enterprise applications in Azure leveraging Azure’s key serverless offerings – Functions, Logic Apps, and Event Grid. Watch the on-demand webinar for more insights.

Azure-Serverless

 

Viplove
Viplove
Technical Architect