How do you Write Azure Functions ?

 How do you Write Azure Functions ?
Written by Pritam DharFebruary 22, 2022
10 min read
Pritam Dhar

The Azure function is a service provided by Azure to run a small portion of code in the cloud. Performance is performed in a serverless cloud computing system.

Introduction to Azure Functions :

The Azure function is a service provided by Azure to run a small portion of code in the cloud. Performance is performed in a serverless cloud computing system. The developer has to code the snippet and place it in the cloud, of course, it runs on the server but the responsibility of managing the server is not on the developer, it is taken care of by Azure. Functions can be created in any language of choice, such as Python, Java, etc. Functions also promote code reusability because it does not depend on the application. This is a simple piece of code created to perform a task. As a service provided by Azure, we can call the Azure function a function.

Why do we Use Azure Functions :

Initially, Azure capacities are executed in a serverless way, so the designer doesn't have to stress over the server the board. It gives as the mix of IAAS and PAAS administrations. Capacities can be created utilizing web instruments or assemble devices of the engineer's decisions and are extremely simple to send. Upholds an assortment of programming dialects like C#, Java, Python, NodeJS, and so on Capacities can be set off effortlessly founded on any occasion, for example, mass compartment creation, HTTP demand, Using Cron, Queue trigger, Webhook trigger, time-sensitive trigger, and so forth Likewise with the utilization of improvement and arrangement, it additionally incorporates security given by Azure like Azure Active Directory. Every one of the highlights makes Azure Functions extremely famous for serverless distributed computing.

How to Write Azure Functions :

It is very easy to develop Azure functions using the following steps:

Step1: Go to the Azure portal.

Step 2: Click on the + icon to add a resource.

Step 3: Choose the function app from resources.

Step 4: Provide parameters while creating azure functions.

Some parameters must be marked with an asterisk, such as:

  • Resource Group: In which group resource needs to be created.
  • Subscription: Account subscription to be used for function app creation.
  • Function App Name: Choose app name it should be unique across Azure.
  • Publish: Either code or docker can be deployed.
  • Runtime Stack: Choose a runtime stack according to your favorite programming language.
  • Storage Account: Choose the storage account required for function app processing. You can either choose an existing storage account or can create a new one.
  • Operating System: Choose an operating system based on the requirement. It can be either Windows or Linux.
  • Plan: There are 3 types of plans while hosting a function. The default is the Consumption plan. This is pay as you go type of plan. The cost will be charged only when the function runs. The hosting plan needs to be decided based on the requirement, such as function scalability, Vnet connectivity, etc. There are 3 types of plans:
  1. Consumption Plan: This is a pay-as-you-go plan. Only costs will be charged while running the function. Assets are dynamically added or removed based on events, so azure takes care of scalability. Execution time out can be configured based on requirements. Multiple apps running in the same region may adopt the same plan. Billing can be based on the number of executions, the memory used, and the execution time.
  2. Premium Plan: It is fundamentally an expansion of the utilization plan for certain extra given highlights, for example, Vnet availability, limitless execution term, Perpetually warm occurrence. In the exceptional arrangement, charging is done given the number of centers utilized each second, the quantity of pre-warmed occurrences. Additionally, there ought to be somewhere around one pre-warm example constantly. This implies there is a particular month-to-month cost that will be charged notwithstanding several executed applications.
  3. Dedicated App Service Plan: As the name propose this is a die-hard loyalty plan. It implies there is a devoted arrangement of VMs for the capacity application. You can likewise pick your picture on what capacities should be executed. For versatility, More VMs can be added at runtime physically or Autoscaling can likewise be empowered.

Step 5: Click on review and create to review the configurations.

Step 6: Click on create a function to deploy the function.

Step 7: Go to your resource group and you will see a function app that will be created with the name provided as above.

Step 8: Choose the function app, choose in-portal and create an HTTP triggered function inside the app.

Step 9: The function will be triggered by the HTTP request.

Step 10: When the function is created there will be a URL provided.

Step 11: Paste URL in the browser address bar and you will see the response based on the code written in function.

Advantages and Disadvantages :

  • Given below are a few advantages and disadvantages explained.
  • The biggest advantage of this is its serverless execution, the developer doesn’t need to worry about the management of the server.
  • Supports a variety of programming languages such as python, java, c#, NodeJS, etc.
  • Supports all security services provided by Azure such as Azure active directory etc.
  • Very easy to trigger functions based on various events.
  • It can be developed by a web-based tool or any other build tool based on developer choice.
  • As it is a very lightweight code, provides smooth execution.
  • Vendor-lock is the biggest drawback of this function.
  • It is very difficult to run code deployed in Azure function outside the azure environment.
  • As the language used in function apps such as java, NodeJS, etc are not specialized but code to establish a connection between resources is specific to azure.

Conclusion :

In this article, we discussed the overview of Azure Functions and How to Write Azure Functions.

Azure Functions
Was this blog helpful?
You must be Logged in to comment
Code Block

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance