What and Why of Azure Functions

Azure Functions enables developers to build and deploy small, single-purpose functions that automatically scale to meet demand.

Mentor

Blog

What: Azure Functions (from Microsoft Azure) is a cloud-based serverless service that allows running event-triggered code in a scalable way without providing or managing infrastructure. It enables running a script or piece of code in response to various events and doesn’t need to run continuously. They can be written in several languages, including C#, F#, Java, JavaScript, Python, TypeScript, and PowerShell. They’re also scalable, and when the demand for code execution increases, the necessary resources are automatically allocated for the request.

Why: Picture this. After completing a specific e-commerce process, you always want to email or notify your clients. To do this, you have to build an entire system for it. However, with Azure Functions, you don’t need any infrastructure. Just write your code and its designed action, and deploy it to the Azure cloud. The scenario above is the perfect example of defining what Azure Functions is. Functions enable event-triggered codes to run without the need for infrastructure. In addition, these event-triggered codes or scripts will not run continuously, improving the said codes' scalability.

Use Cases: Generating notifications and remindersProcessing filesScheduling tasks and messagingProcessing data and data streamsImplementing background backup tasksLightweight APIsProof of Concepts and MVPsBackend calculations

Pros: Integration with Other Azure ServicesSupports Different Programming LanguagesThe interface is Intuitive and Browser-BasedContinuous Integration and Continuous Deployment (CICD)Runtime PortabilityCustom Features ImplementationPay-as-You-Use and Cost-Efficient

Cons: It is not a replacement for Web APIs. However, in some instances, they are excellent Web API extensions. It is designed to execute a single or few things as fast as possible, so it can’t perform multiple tasks. Since it is a compute-on-demand service, it is not best for intensive computing and long-running functions.