Create Azure Functions Using Azure Portal

Introduction

In this article, we are going to talk about Azure Functions and how you can without difficulty create your first Azure feature app the use of Azure Portal. This is the first article of my new collection referred to as Azure features for beginners. So in this article, we are going to talk about Azure functions only.

What are Azure Functions?

Function As A Service (FaaS) is a class of cloud computing offerings that offers a platform in which you simply want to suppose about writing enterprise good judgment besides questioning about the infrastructure required for its execution. Microsoft Azure gives two sorts of FaaS i.e Azure Logic Apps and Azure Functions. So in this article, we are going to talk about Azure features only.

According to Microsoft docs:

Azure Functions allows you to run small pieces of code (called “functions”) without worrying about application infrastructure. With Azure Functions, the cloud infrastructure provides all the up-to-date servers you need to keep your application running at scale. 

Azure features are event-driven which skill that you can run your characteristic code when some tournament is induced from both present on-premise provider or any different Azure provider or  third party service. The azure feature can be scaled and you want to pay solely for the sources as you consume. Azure features aid plenty of set off factors such as Http trigger, queue trigger, etc.

Some of the features of Azure functions are:

  • Azure Functions has brilliant language aid such as C#, Java, JavaScript, Python, and PowerShell.
  • Supports a lot of triggers such as Service bus trigger, Http triggers, Queue trigger, etc.
  • We want to pay solely for the assets as you eat i.e. Pay-per-use pricing model
  • We can set up any of the libraries of your desire the use of NuGet or NPM
  • We can effortlessly enforce CI/CD the usage of Github, Azure DevOps Service
  • We can additionally add built-in protection on Http induced primarily based Azure features the use of OAuth companies such as Azure Active Directory, Facebook, Google, Twitter, and Microsoft Account.

Below are a number of templates reachable for developing Azure feature for performing different operations:

  • HTTP trigger
  • Blob storage trigger
  • Queue storage trigger
  • Service Bus Queue trigger
  • Service Bus Topic trigger
  • Timer trigger
  • Event Grid trigger
  • Event Hub trigger
  • Azure Cosmos DB trigger

You can get extra facts about Azure Functions here. So in this article, we are going to create an HTTP trigger-based Azure characteristic the usage of C# from Azure Portal. I will cowl all different kinds of templates in my subsequent article.

Create Azure Function using Azure Portal

Prerequisites 

Azure account (If you don’t have an Azure subscription, create a free trial account

Step 1 – Creating a Function App

While growing a feature you have to have a characteristic app to host the execution of your functions. You can team more than one features into one characteristic app which helps for deployment, scaling, convenient for improvement & sharing of assets One feature app can have a couple of functions.

Log in to the Azure portal.

In the Search bar, search as “function app” and then pick out the Function app.

After that click on on the “Add” button to add a new feature app. Fill out the primary details:

  • Azure has Resource Groups(RG) which acts as a container for your resources. So now we are going to create a feature app aid then first we want to create a Resource Group. If you have already created RG then you can use the identical here. Under the Resource team click on on the Create New button and supply a special RG name. I have chosen an present aid group.
  • You want to grant a special identify for your characteristic app.
  • Select an splendid run time for your app. Since we are going to create a feature the usage of C# so I have used .net core as runtime.
  • Select a model and region.

Once we crammed out fundamental details, then click on on the Next: Hosting button.

  • You want to supply a storage account whilst growing a characteristic app. If you have already created a Storage account then you can use the identical here. Or you can create new as well.
  • You have to choose an running gadget on which your app desires to be run.
  • Finally, you have to choose a pricing layout for your app. You can see extra important points about Pricing right here

Once we crammed out web hosting small print then click on on the Next: Monitoring button.

Application Insights, a function of Azure Monitor, which is an extensible Application Performance Management (APM) provider for builders and DevOps professionals. It is used to screen your stay applications. So if you favor to combine it in your feature app the pick Enable Application Insights flag to Yes.

Now click on on Review:Create button and assessment all the small print and click on on the Create button. Wait for a few minutes to create the resources.

Once deployment complete click on on Go to aid button to see out new characteristic app.

Step 2 – Creating an HTTP triggered based Azure Function

Once you navigate to the Function app then click on on Functions in the left panel and then click on the Add button.

Now pick the HTTP set off from the proper panel. Now set Name and Authorization degree for your new function.

  • Provide a identify for your new function.
  • To avoid the use of your feature we can set the Authorization level. There are three sorts of tiers available: 1] When we set stages as Function, then we have to supply a feature key to name our function. 2] When we set as Admin, then you want to furnish the grasp key. Both the characteristic key and admin keys are located in the ‘keys’ administration panel on the portal when your characteristic is selected. 3] When we do not choose any authorization then we can virtually set degree as Anonymous.

Now click on on the Create Function button. You then robotically redirect to characteristic as soon as the characteristic is efficiently created.

Click on the “Code + Test” button underneath the Developer area from the left sidebar panel.

So you can see the simple characteristic code written which accepts title from the question string or from the request physique and append to title to the Hello string and return the output.

Step 3 – Testing of Http triggered based Azure Function

Now click on on the “Test/Run” button. For this default function, you can supply the enter property title from both physique or both from the question string.

Click on the Run button from the proper panel. So you can see the output in the “Output” tab in the proper panel.

This is all about strolling it from Portal. You can run this characteristic from the browser or from the postman as well. To get the feature URL click on on the “Get Function URL” button.

Copy the URL.

Since our function accepts input property identify from the question string then paste the URL into the browser and append ?name=AzFunction and hit the URL. You will see the output in the browser.

Since this is the HTTP Trigger characteristic we can run it from postman as well. So paste the URL in postman and ignore enter and see the output.

That’s it. You have created your Azure feature the usage of Azure Portal.

Conclusion

In this article, I have defined Azure Functions and how to create a characteristic the use of the Azure Portal. Also, I confirmed how to take a look at characteristic from portal, browser, and postman. I certainly hope that you loved this article, share it with friends, and please do no longer hesitate to ship me your ideas or comments. Stay tuned for extra Azure Functions articles.

28 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

twenty + twenty =

You May Also Like