Month End Sale: Get Extra 10% OFF on Job-oriented Training! Offer Ending in
D
H
M
S
Get Now
What is Serverless Computing? Exploring Azure Functions

What is Serverless Computing? Exploring Azure Functions

18 Jun 2024
Intermediate
10.2K Views
19 min read
Learn via Video Course & by Doing Hands-on Labs

Azure Developer Certification Course (Az-204)

Serverless Computing and Azure Functions

Serverless computing is one of the most coined terms in the cloud these days. Unleashing the PaaS feature with an immense amount compute power without any server to host an app has impacted web development in a big way. If we talk about Azure Functions, it is a serverless solution that allows you to write less code, maintain less infrastructure, and save on costs.

In this Azure Tutorial, We will explore more about Serverless Computing and Azure Functions including Monolithic Architecture, Azure Services, and detailed Azure Functions.

Breaking the Monolithic Architecture

  • Earlier, we used to build one big application with a very complex architecture to maintain, which involved integrating all modules of an application that were tightly dependent on each other.
  • Any failure on any of the modules was making the entire application go down.
  • To resolve this issue, we moved on to segregating the modules into different services. This allows us to use different technology stacks for different microservices and deploy each of the microservices independently.

Breaking the Monolithic Architecture

  • Now, the number of microservices increased, and the challenge became to host different instances of microservices on multiple servers to keep the application running.
  • Serverless computing helps us mitigate such issues by using Azure Functions as we have only functions that take care of different modules interacting with third-party services like cognitive services or Sigle sign-on services, Graph and chart image services, etc.
  • Cloud service providers manage to identify and allocate resources dynamically rather than pre-provisioning a set of virtual blocks of the resource with some limited set of computing power. And that’s how Serverless compute modules can be scaled on runtime.

Azure Services based on Server-less Architecture

Microsoft offers the below Azure services to facilitate Serverless computing-

  1. Serverless Coding

    Azure functions are event-triggered pieces of code with logic to perform a specific task by connecting to different Azure or third-party services. Compute power and resources are utilized only when the function executes. We only need to pay per request to the function.

  2. Storage

    Azure Storage is a highly reliable and scalable service that can be used to store structured or unstructured data. It connects with other Azure services seamlessly and can act as a third-party data source for images, videos, or any other content

  3. Database

    Azure Cosmos DB can act as a third-party data source service. Azure functions can connect to Cosmos DB and can read data to process. The important feature of cosmos DB is it can replicate to a different region with the highly scalable option to provide low latency.

  4. Sign In

    Azure AD can be used as a login service to connect with cloud-based identity and access management. All user data and roles can be managed via Azure AD user management.

  5. Messaging

    Azure Service Bus is a messaging service that processes data in an order. We can use Queues or Topics to ensure that every message that comes in the pipeline is processed. This can be used as a fully managed messaging service provider.

  6. Workflow

    Azure logic apps are used to orchestrate functional workflows by integrating various Azure and third-party services to connect data to the apps.

  7. Intelligence

    Cognitive services like vision and speech recognition, language detection, and emotion and sentiment detection help to add artificial intelligence to the application.

Azure Functions

  • Azure functions are serverless compute modal element that runs code on demand and without the need for hosting it on a server.
  • This also frees us from any complexity in application architecture, as we only write the code required to perform a specific task.
Azure Functions

Key Features of Azure Functions

  1. Independent Module—Functions can be developed as independent modules. We can import NuGet libraries and use them to build small but robust applications. These can then be further integrated into other applications or workflows.

  2. Pay per use - Unlike other PaaS Services where a dedicated amount of resources and compute power is charged with the Azure App Service plan, Azure functions are charged on the basis of the number of times it run.

  3. Language Choice—Azure supports Functions written in various languages, such as C#, F#, Node.js, PHP, or Java.

  4. Security - HTTPTriggered Functions can be secured using OAuth Identity Providers such as Azure AD. The token generated using AD can be passed into the HTTP request header which can be validated in the code.

  5. Easy Development—We don’t even need to write code in an IDE. We can directly write code in the Azure portal and test it or set up continuous integration and deploy code through VSTS and GitHub.

Creating Azure Function Application

  1. Click on Create a Resource on the Azure portal.

  2. Select the Compute option from the marketplace and click on the Function app.

    Select the Compute option from the marketplace and click on the Function app.

  3. Provide the function app name, resource group, hosting plan, and storage account details, and click Create.

    Provide the function app name, resource group, hosting plan, and storage account details, and click Create.

  4. Check on the Notification icon at the top right corner and click on the Go to Resource button.

    Check on the Notification icon at the top right corner and click on the Go to Resource button.

  5. Click on the add (+) symbol to add an Azure function.

    Click on the add (+) symbol to add an Azure function

  6. A HTTP trigger function with some default code is created. We can test the app by clicking on the Run button and passing some text as the input body of the request.

    A Http trigger function is created with some default code. We can test the app by clicking on the Run button and passing some text as input body of the request.

Uses of Azure Functions

  1. Data Processing through connected services. When a new file is uploaded into blob storage some specific processing is required.

  2. Triggering a chain event on some event on some connected Azure Service like when a new message arrives on a queue.

  3. They can also act as middleware between different services in a microservice architecture.

Azure Function Pricing

Azure Functions can be hosted with two different kinds of pricing

  1. Consumption plan

    It provides all necessary resources to the function app dynamically and will charge only when the function runs.

  2. App Service plan

    If you are already using an app service plan for other app services, such as a web app or API app, the same hosting plan can be used here at no extra cost. You will be charged only for the number of times the function app executes.

Limitations

  1. Lack of Troubleshooting methods—It's difficult to identify an issue in production since there is no way to debug a function. Azure provides an app insights feature by default with the Azure function to help analyze the logs.

  2. Third-Party API Trust—Since Serverless computing heavily relies on third-party services, we need to trust their response and security.

  3. Vendor Locking—Outbound requests may also be expected to return quickly, which can be further processed. Any lock state in third-party services will cause delay and unexpected behavior.

  4. Overly Complex Architecture—Too many functions in an application may also result in a very complex architecture that is difficult to manage.

  5. Latency—The initial booting time and latency over the network caused by hoping from one function to another increase latencies and may impact the SLAs.

Summary

Serverless is a style of architecture in which we do not worry about hosting the application or the required infrastructure to make the app run. Azure functions are Serverless and lightweight, and writing and deploying them is simpler. Scholarhat Azure online training is delivered by Microsoft MVP Mr. Shailendra to help you earn Azure real-time focused Hands-on skills and get Azure certification.

FAQs

Q1. What is the concept of Azure Functions?

Azure Functions is a serverless solution that allows you to write less code, maintain less infrastructure, and save on costs. 

Q2. How many types of Azure Functions are there?

There are currently four durable function types in Azure Functions: activity, orchestrator, entity, and client.

Q3. Is Azure Functions IAAs or PaaS?

Azure Functions is a serverless platform as a service (PaaS).

Take our Azure skill challenge to evaluate yourself!

In less than 5 minutes, with our skill challenge, you can identify your knowledge gaps and strengths in a given skill.

GET FREE CHALLENGE

Share Article

Live Classes Schedule

Our learn-by-building-project method enables you to build practical/coding experience that sticks. 95% of our learners say they have confidence and remember more when they learn by building real world projects.
Azure Developer Certification Training Jul 28 SAT, SUN
Filling Fast
10:00AM to 12:00PM (IST)
Get Details

Can't find convenient schedule? Let us know

About Author
Rupesh K. Roy (Author, Speaker and Microsoft Certified Trainer)

He is an Author, Technology Speaker and Microsoft Certified Trainer on .Net and Azure platforms. He has more than 5 years of industry expertise and has worked as a developer with the most prominent companies on Azure, .Net Core and React JS. He is passionate about learning and sharing new technical stacks.
Accept cookies & close this