Azure Function App

In this article, we’ll learn about Azure Functions and Azure Function app. Then we’ll go ahead and learn the process of creating the Azure Function app step-by-step. Next, we’ll create the HTTP trigger function and finally test it too.  

Azure Functions 

Azure Functions is the popular serverless compute platform on Microsoft Azure, supporting rapid integration with the Microsoft suite of products. Azure Functions is an event-driven serverless compute platform which enables complex orchestration difficulties to be solved easily. Using Triggers and Bindings, services can be integrated. Applications can be deployed and scaled flawlessly in the cloud with Azure functions. Depending on the workload volume, the infrastructure scales automatically. Building, debugging, deploying, and monitoring are all possible with ease with the built-in DevOps capabilities supported by the Azure Functions. It supports multiple programming languages from C#, Python, Java, or Node.js. With the use of Azure Functions, it can drastically minimize the time to solve problems compared to traditional approaches thus saving the time of developers and duration to provide service to the clients. Learn more about Azure Serverless from the previous article, Azure Serverless. The Azure Function allows us irrespective of the setup of virtual machines or publishing of the web applications to run our code in the serverless environment.  

Azure Function App 

In order to host the execution of the functions, Azure Function App is integral. The function app allows grouping of the functions for convenience in deployment, management, resource sharing, and scaling as one logical unit. Let us learn to create the function app in Azure through the step-by-step tutorial.  

Step 1 

First of all, visit the Azure Portal and click on Create a resource.  

Step 2 

Now, on the search bar in the marketplace, find Function App.  

Click on Function App.  

Step 3 

Under the Function App plan, click on Create.  

Step 4 

Now, we are taken to the page to fill the details to create the function app.  

Select the appropriate subscription and choose your resource group. If you don’t have one, create a new one.  

Step 5 

Fill in the instance details: the function app name, the method of publishing, runtime stack, version, and region. I’ve selected Code for publishing and .NET as runtime. The region is the location where you want to setup this service. It is better to select one near to the expected location of your users.  

Under the Operating System, I’ve selected Windows and Consumption (serverless) for the plan type.  

Step 6 

Now, under Monitoring, select yes for enabling the Application insights.  

Once done, click on Review + Create.  

Step 7 

Next, Click on Create.  

The deployment process is initialized.  

Step 8 

As the deployment process proceeds, we can see the services and templates being created.  

As the deployment is complete, we are provided with the “Go to resource” button to access the service we created.  

Step 9 

We can see the details of the Azure Function app we created here. The URL is also showcased to explore.  

The Metrics are all visualized for Memory, Function Execution Count and the time duration of the execution unit.  

Creating the Trigger Function 

Step 10 

Now, Under Functions in the left menu, click on Functions.  

Now, click on Create Button.  

Step 11 

Here, we are provided with the Development Environment through the Portal itself.  

Also, we are given the choice of the template we want to use with the options of HTTP Trigger, Azure Queue Storage Trigger, Azure Event Hub Trigger and more. Aside is described in detail about the function.  

Step 12 

We’ll select the HTTP Tigger.  

Now, we name our New Function and set the Authorization level to Function.  

Once, all is set, Click on Create.  

Step 13 

The notification is updated about the creation of the function HttpTriggerEx1.  

As we visit the details page of our function, we can see visualizations in detail. We can see the status is Enabled i.e. It's currently running.  

Function Testing

Step 14 

Now, under the Developer menu, select Code + Test.  

Here, we have the HTTP Trigger code where we have an output message once the function is executed successfully.  

Click on Get Function URL.  

Set the Key to Default and copy the URL.  

Step 15 

Now, on your browser, paste the URL.  

We can see the HTTP trigger success message that the HTTP Triggered function has been successfully executed.  

 

We can also see the logs about the execution with more details such as the time duration and on-going request processing.  

Thus, in this way, we can create Trigger functions using the Azure Function App which can be used for various applications for different needs ranging from HTTP Trigger to Azure Event Hub, Azure Service Bus, Azure Storage, and more.  

Conclusion 

Thus, in this article, we learned about Azure Functions and Azure Function App. Thereafter, we went through a step-by-step tutorial to create the Azure Function App, create a Trigger in the development portal itself and tested it. With this article, we have now successfully learned to use the Azure Function App. This knowledge can now be applied to different use case scenarios for various project when we want the Azure Serverless functionality.