This is the first in a series of articles to help get started with Azure Functions. We begin our journey with a brief overview of concepts.
As cloud usage has increased in the past few years, one of the features that has gained popularity is serverless computing.
Serverless doesn't mean that there are no servers. It simply means that server infrastructure is managed by the cloud provider. As developers, we can focus on creating applications without worrying about managing the infrastructure to run those applications.
While serverless covers many cloud services, the one that is most widely used (or at least has the most mind-share) is Function-as-a-Service (FaaS). A function is a piece of code written for a single, specific purpose. Think of it as a small program meant to respond to a specific event - an event handler.
Azure Functions is the implementation of FaaS in Microsoft Azure cloud.
A function runs in response to a trigger. A trigger is an event like HTTP request, file upload etc. Below are some of the common triggers for Azure Functions:
|HTTP||HTTP request is received|
|Timer||Time as per a predefined schedule|
|Blob||File is uploaded to Storage Container|
|Storage Queue||Message arrives in Storage Queue|
|Service Bus||Message arrives a Service Bus queue or topic|
|Event Hub||Event arrives into an Event Hub|
Azure Functions supports several programming languages. We can develop functions using any of the following:
- C# (.Net)
Using Azure Functions offers several benefits.
Since we don't have to worry about managing the underlying infrastructure, we can focus on developing our application. This is particularly helpful when developing event-driven applications. Also, tools like Visual Studio Code offer excellent development support for Azure Functions.
Since Functions are managed by Azure itself, they can scale automatically based on load or demand.
Azure Functions help us optimize cost and we can choose to only pay for compute resources when our functions are running.
The primary disadvantage of using Azure Functions is that we have very little control over the underlying environment. For instance, only certain versions of a language or framework may be supported. If using a specific version is required, it may not be supported. Similarly, we may not be able use Azure Functions if there are special hardware or licensing requirements.
That was a quick look at the concepts for understanding Azure Functions. In the next article, we will jump into development create our first Azure Function.