What Is Azure Functions

What Is Azure Functions

In this Azure tutorial, we will discuss What Is Azure Functions. Along with this, we will also discuss the below topics.

  • Features of Azure Functions
  • What are the benefit(s) to use azure functions?
  • What is Azure Functions Used For
  • Azure Functions Triggers
  • How Do Azure Functions Work
  • Azure Functions Pricing
  • Azure Functions Versions
  • What languages can be used for azure functions?
  • What is a function app?

What Is Azure Functions

Azure Function is an Azure Service from Microsoft that helps you to run some pieces of code smoothly without getting worried about the infrastructure for your application.

In other words, Azure Functions is an event-based service from Microsoft that helps the existing Azure application platform to execute few lines of code that trigger some events to perform some operations without getting worried about your application infrastructure.

In another way, Azure Functions is simply a “Functions-as-a-service” that provides the solution to run a few lines of code or functions in the cloud environment. You just need to worry about writing the code. No need to take any headache for the whole application or the infrastructure.

Azure Functions is called as the serverless computing service ( Serverless means runs the code without needing bothering the hosting and about infrastructure ), that is hosted on the cloud. The main purpose of the Azure Function to make easy application development.

Features of Azure Functions

Well, we discussed What Is Azure Functions?. Now the time to discuss the features of Azure Functions. There are many features available for Azure Functions. Let’s discuss on few key features of the Azure Functions

Multiple Language Support

Azure Functions support many languages. You can write the functions on different languages of your choice like C#, Python, Java,Javascript,PHP,Node.js, etc.

Serverless applications support

With serverless, we can simply create and upload the code for the application, and then we just need to define the triggers or events that will execute the function. It reduces the developer’s time and the unnecessary headache to worry about the infrastructure as a developer.

Pay as you use pricing model 

Azure functions provide the pay as you use a pricing model that helps to save a lot of costs. You just need to pay for the time the code is run. Microsoft will calculate the charge based on the time the Azure function runs per the billing cycle.

Easy integration with Azure services and other 3rd-party services

Another cool feature of Azure Function is, You can easily integrate the Azure Function with different Azure services and Along with that, you can also easily integrate with different 3rd-party services like Azure DevOps services, Github, Azure CosmosDB, Azure Event Grid, etc.

Continuous Deployment and Integration support

Azure Function supports the Continuous deployment and integration because Developers still need them along with GitHub, Microsoft Visual Studio Team Services, Eclipse, etc.

Integrated security

Azure Functions provides integrated security with different applications like Azure Active Directory, Facebook, Google account, etc.

These are few key features of Azure Functions as described above.

What Are The Benefit(s) To Use Azure Functions?

There are many benefits of Azure Functions. We will discuss few key benefits of Azure Functions.

Development became Easy

With the introduction of Azure Function, the developer task becomes easy. As part of the development activity, the Developer will only concentrate on the coding part. Developers will not bother for the management of the infrastructure.

No server maintenance

In case of Azure Function, No server maintenance needed. No headache for the server maintenance now.

Independent scaling

Another very interesting benefit of Azure Function is, it supports independent scaling. This feature has met with early success in cloud environments.

These are the benefit(s) to use the Azure functions.

What is Azure Functions Used For

As we already discussed, Azure Functions makes the app development process easier and helps to process the data, integrate with Azure services and other 3rd party services, Helps to build serverless applications, etc

Azure Functions are best for many purposes. Let’s discuss few key usages of Azure Functions.

  • Best for image processing
  • Best for the purpose of processing orders
  • Timer-based processing task
  • File maintenance activities
  • Azure service event processing activities
  • Serverless web application development and Architectural task
  • Best for the requirement of running a scheduled task
  • Better for the Real-time stream processing activities
  • Best for the Mobile backend development activities.
  • Good for the bot messaging on Real-time

There are many purposes Where the Azure Functions used for. But out of those purposes, above are some key usage of the Azure functions.

Azure Functions Triggers

Azure Functions can be triggered based on the different events from any third-party service or on-premise system.

Azure functions provides different templates for this purposes as a trigger. Below are few examples on those

  • HTTP Trigger: Triggers the execution of your lines of code based on the HTTP Request.
  • Timer Trigger: Triggers the execution of your code based on some Scheduled time.
  • Queue Storage Trigger: This trigger responds to the messages from the Azure Queue storage.
  • Blob Storage Trigger: This storage trigger responds to the messages that come from the Azure Blob Storage.
  • Azure CosmosDB Trigger: Responsible to process the documents of Azure CosmosDB when they are getting modified.
  • EventGrid Trigger: Azure Event Grid trigger reacts to the events delivered to a subscription in Azure Event Grid with the filters applicable.
  • EventHub Trigger: AzurEvent Hub trigger reacts to the more number of events hub events. Good for the workflow processing scenarios as well as IoT scenarios.
  • Service Bus Queue Trigger: ServiceBus Queue Trigger responds to the messages from the Service Bus Queue.
  • Service Bus Topic Trigger: Service Bus Topic Trigger reacts to the messages from the Service Bus topic.

The above are different Azure functions triggers as explained.

How Do Azure Functions Work

Well, let’s discuss on an important concept like How Do Azure Functions Work? exactly.

How Do Azure Functions Work

As we discussed already, we need to have a valid Azure subscription and a storage account before creating a function.

The first work of the developer is to write the code for the function and that they will deploy to the cloud and performs the individual actions, for example, processing the individual files, Handling API calls, etc.

Developers can write their code for the Azure functions using different languages like C#, Python, PHP, Javascript, Node.j and Java, etc.

As we know already, Azure Functions is an event-driven technology. A developer simply writes the code into a function and rest will be handled by Azure like patching, scaling, etc

Developers can save a lot of time as they don’t need to write the code from scratch. Azure functions get triggered with the help of different ways like HTTP triggers, Changes in Azure Storage Blob containers, Azure queues, etc.

A single function will have only one trigger that defines how the function will get executed meaning the execution details.

The azure function triggers the code based on the data as well as one more thing is it plays one more role to access and process that data. That particular data is connected with different input and output bindings. These bindings help the developer to access the data sources and developers no need to take any headache to bother about the flow of data.

One more way, you can take it as the Developer needs to provide the input as a parameter to the Azure Functions and then after the function processes it and provides the result as the Output.

Developers can configure the triggers and bindings in the function.json file in Azure Portal. The events are monitored and when the event triggers, the functions are used to process the events.

The cloud provider performs the scaling activities of the resources automatically. It can also be done to scale up or down based on the demand.

The Azure Functions have different templates that contain a set of predefined functions that we have already discussed on the Azure Functions Triggers section.

Azure Functions Pricing

The Azure Functions Pricing model is basically based on three plans as below. You can choose the plan based on your requirement

Consumption plan: As per this plan, Azure provides you all the computing resources that are needed for the activity. You need not worry about the compute resources. You just need to pay for the time your code is running. Azure functions are billed based on the resource consumption that is measured by GB seconds.

Functions those are running on a Consumption Plan have a timeout of five minutes by default.

How they calculate that exactly is they will multiply the average memory size in GB by the execution time that takes to execute the function in milliseconds. The memory used by the function is calculated from 128 MB to the max 1,536 MB.

The minimum execution time is 100 ms and the minimum memory for a single function execution is 128 MB. Functions pricing that includes a monthly free grant of 4,00,000 GB seconds.

Premium plan: As per this plan, Azure will provide you if any of the additional computing resources needed for the activity. You need to pay for the resources running continuously that are initially defined by you and also any additional instances you need to use as Azure scales your application in and out operations.

App Service plan: As per the App Service plan, If you using your App Service for your other applications, your Azure functions can run on the same App Service plan at no extra cost.

No default time out for this particular plan. It is unlimited for this plan. Your Function may run for as long as it needs to.

As part of this plan, we need to provision a dedicated Virtual Machine meaning you need to pay for those resources even if you are not using them completely.

If you will go little in depth

MeterPricing DetailsFREE GRANT (PER MONTH)
Execution Time₹0.001058/GB-s4,00,000 GB-s
Total Executions₹13.220 / million executions1 million executions

As per the Premium Plan

MeterPricing Details
vCPU durationvCPU: ₹11.434652 vCPU/hour
Memory durationMemory: ₹0.812984 GB/hour

For more information on the Azure Functions billing details, you can refer to the Microsoft Official site.

Azure Functions Use Cases

As discussed already, Azure Functions are code-based and event-driven. You can build and test them on our local system. Azure Functions are portable and more flexible for different languages. Some common use cases for the Azure Functions are

  • Scheduled based triggers
  • Software as a service event processing activities
  • Different service Azure event processing activities
  • serverless web application and mobile application development.

These are few Azure functions use cases. Again you can create some of the Azure function based on your business requirement.

Azure Functions Versions

The Azure Functions versions are equivalent to the .NET versions. Azure function runtime version 1.x is available and the equivalent .Net framework version is 4.6. The next version of Azure functions runtime version is 2.x is available with the equivalent .Net core 2.x version. And then the other Azure functions version is 3.x which is in Preview mode and the relevant .Net core 3.x version.

What languages can be used for azure functions?

As we already discussed Azure functions support different languages. You can use a language based on your choice. That is one of the great advantages of Azure Functions. The support of the languages based on the Azure Functions runtime versions as well.

For the Azure Function run time version 1.x: The languages supported are C#, F# and JavaScript.

For the Azure Function run time version 2.x: The languages supported are C#, F#, JavaScript, Python, Java 8, PowerShell.

For the Azure Function run time version 3.x: The languages supported with this version are C#, F#, JavaScript, Python, Java 8, TypeScript.

So this is all about the different languages supported based on the Azure Functions runtime versions.

What is a function app?

Function app is an execution context where exactly the Azure Functions are hosted on. In another way, if you are creating a project, you can call the Function app as the Project where you want to deploy your functions.

As a prerequisite, what we need here is, We need a valid Azure Subscription or Azure Account and then we need a valid Service plan based on the pricing plan for the Azure Function.

The second thing that we need is one Storage account needs to be created before starting with the Azure Function app. The storage account is used to link to the function app. internally, it uses this storage account for storing the function code and configuration details.

There are multiple ways to create a function app. Those are like using the Azure Portal, Using Azure CLI, Using Visual Studio, and Using the Visual Studio Code as well.

You may also like following the below articles

Conclusion

Well, here in this article we discussed, What Is Azure Functions, Features of Azure Functions, What are the benefit(s) to use azure functions?, What is Azure Functions Used For, Azure Functions Triggers. Along with this, we also discussed, How Do Azure Functions Work, Azure Functions Pricing, Azure Functions Versions, and finally we discussed, What languages can be used for azure functions? and What is a function app?. Hope you have enjoyed this article !!!

Leave a Comment