Introduction
According to Wikipedia, "Microsoft Azure is a cloud computing service created by Microsoft for building, testing, deploying, and managing applications and services through Microsoft-managed data centers. It provides software as a service (SaaS), platform as a service (PaaS) and infrastructure as a service (IaaS) and supports many different programming languages, tools, and frameworks, including both Microsoft-specific and third-party software and systems".
This tutorial will guide you on an overview and features of Azure Functions.
In the series of Azure Functions, I am describing the overview and features of Azure Functions. This article will cover the following topics:
- An Overview of Azure Functions
- Features of Azure Functions
- Working With Functions
- Pricing of Azure Functions
An Overview of Azure Functions
Azure functions are used to execute small pieces of code (known as functions) regardless of the application's infrastructure. Cloud computing, including Azure functions, includes all the up-to-date servers you need to keep a scale working application.
A function is automatically "triggered" when a particular type of event is executed. Responding to changes in data, messages, running on a schedule, or as the result of an HTTP request are various triggers available in Azure Functions.
Features of Azure Functions
Below are some of the key features of Azure Functions. Let's discuss them one by one.
Open Source
Runtime functions are open-source and accessible on GitHub.
Choice of language
You can write functions in Azure using any language, depending on your preference such as C#, F#, Java, JavaScript, Python, and PowerShell.
Serverless Applications
Functions help you to build serverless applications on Microsoft Azure.
Note
Serverless computing allows developers to create applications more rapidly while reducing the need to manage infrastructure for them. The cloud service provider also offers, scales, and handles the infrastructure required to run the code in serverless applications. The term serverless derives from the fact that the activities involved with providing and maintaining the infrastructure are hidden to the developer. This strategy helps developers to concentrate more on business logic and bring more value to the core business. Some benefits of Serverless Computing are,
- No Infrastructure Management
- Dynamic Scalability
- More efficient usage of resources
Flexible Development
The user can directly set up continuous integration and deploy the code through GitHub, Azure DevOps Services, and other supported development tools.
Simplified Integration
Azure functions are conveniently compatible with Azure services and software-as-a-service.
Integrated Security
One of the most important features is that users can protect HTTP-triggered functions from OAuth providers such as Azure Active Directory, Facebook, Google, Twitter, and Microsoft Account.
Use Custom libraries
Azure Functions supports both NuGet and NPM, giving you access to your favorite libraries.
Stateful Serverless architecture
Organize serverless applications for long-term availability with Durable Functions.
Note
(I will discuss on "Durable Functions" in detail in my coming article). But here, let me tell you about the concept of durables functions.
This is an Azure Function Extension that helps you to write stateful functions in a serverless computing environment. The extension lets you describe stateful workflows using the Azure Functions programming model by writing orchestrator functions and stateful entities by writing entity functions.
Price model based on pay-per-use
The most attractive feature of Azure Functions is that you have to pay for the time spent running the code. We will discuss the different pricing models in the "Pricing of Azure Functions" topic.
Working with Functions
Functions are a perfect solution for bulk data processing, network management, internet-of-things (IoT) operations, and easy APIs and micro-services development.
There are a number of templates available in Microsoft Azure Functions to get you started with key scenarios, including:
- HTTP
Users can run the code based on HTTP requests.
- Timer
Users can schedule the code to run at the predefined time.
- Blob Storage
You can create a function that will trigger when files are uploaded to or updated in a Blob storage container.
- Queue Storage
It is used to respond to the Azure Storage queue messages.
- Cosmos DB
Users can process a new and modified Azure Cosmos DB documents.
- Event Grid
Azure Event Grid is a cloud event service. Event Grid allows you to create a subscription to Azure services or third-party resource events. It is used to respond to the Azure Event Grid events through subscriptions and filters.
- Event Hub
It is used to react to high-volume events in the Azure Event Hub.
- Service Bus Queue
Connect to other Azure or on-site services by responding directly to Service Bus queue messages.
- Service Bus Topics
Azure Functions combine through triggers and bindings with Azure Service Bus. Integrating with the Service Bus gives you the ability to execute the functions that respond to and send queue or subject messages.
Pricing of Azure Functions
Three kinds of plan services are available in Azure Functions.
- Consumption Plan
- Premium Plan
- Dedicated Plan
Let's discuss them one-by-one.
Consumption Plan
In Consumption Plan, you have to pay only for the period when your code or application runs. In Azure Functions, billing is based on execution number, execution duration, and the memory utilized. Within a function app, billing is aggregated overall functions.
The same Consumption Plan can be applied to function applications in the same area. There is no drawback or risk of several applications running on the same Consumption Plan. Assigning multiple apps to the same Consumption Plan will have no effect on increasing the app's flexibility, scalability, or usability.
The Consumption plan is the hosting plan by default which provides the following benefits:
- Just pay while you have functions running
- Scale-out automatically, even through long loading times
Premium Plan
The user has designated a set of pre-warmed cases, which are already online and ready to react instantly. Azure provides any additional computing services that are required when your function is running. You pay for the constantly operating pre-warmed instances including any additional instances you need to scale the Azure app in and out.
When using the Premium plan, Azure Functions host instances are added and removed based on the number of incoming events.
Rather than billing by execution and memory consumed, Premium plan billing is based on the number of core seconds and memory used in the required and pre-warmed instances. There must always be at least one instance warm per plan. That ensures there is a fixed monthly expense per active plan, no matter how many executions there are.
Dedicated (App Service) Plan
When you're using App Service for other applications, your functions will run on the same plan at no extra cost. You may scale it out manually by inserting further VM instances for an App Service plan. You may also have autoscale enabled.
For the following scenarios, consider an App Service plan:
- When you have existing, underused VMs, which also operate other instances of the App Service.
- You want to have a customized image to run your functions on.
Reference
https://docs.microsoft.com/en-in/azure/azure-functions
Conclusion
In this article, we discussed the overview of Azure Functions and their features. In the next article on Azure Functions, I will describe in detail How To Create Azure Functions.
I hope you enjoyed this article. Follow C# Corner to learn more new and amazing things about Microsoft Azure.
Thanks for reading!