Open In App

Microsoft Azure – Simple way to Create a Function App

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

In this article, we will learn how to create a function app. Here, we are going to start from the Azure home page, which you can see that it is a very prominent create a resource, and that is where you are going to go for creating any type of resource.

In this article, we are going to look into how to create a function app. It’s going to load the new full-screen create an experience. This is similar to what you would do with a web app or a storage account.

You start by selecting the resource group where you want this resource to be. In this case, select a  functions resource group that you want to use. Then go to name my function. If you give it a name that is already taken, you can see that validation is happening on the fly, which makes it very easy to know what you need to correct. In this case, you are going to give it a unique name. 

The next option you will get is what are you going to be publishing to your function there? Basically, are you going to be writing this as a piece of code? Or are you going to be wrapping in a container? Azure Functions support both Docker containers as well as publishing code, so it’s really up to you what you want to use. In this article, we have chosen code for demonstration because that also allows us to show you the fact that we have a runtime stack selection, which basically tells the runtime what is the code that you’re going to be writing on? You can do PowerShell, Java, Python, Node.js, or NET Core. Let us move with the NET core. And, Azure supports NET Core 3.0.  Next would be what is the region where you want to host this?

Then at this point, you could just go to review and create and what this will do is it will default you to consumption, which is also the serverless tier. So, in this mode, you don’t need to configure your scale; your app will scale automatically depending on the number of requests or the time that it gets triggered. 

If you want to change that and go into advanced mode, you could click into the hosting tab and at this point, you can specify more advanced settings for your function. For example, if you have a specific storage account you want to use, you can select it. If you have a preference over operating system limits versus Windows, you can choose that. Usually depending on the runtime stack that you’re selecting, Azure will make recommendations as a default. But if it’s supported, you can always switch it around to whatever fits your needs. 

And then you come to the plan, which is basically the underlying app service plan that is providing the compute for your resources. When you are in consumption, you are in the serverless mode, which means you don’t need to configure the size of the machine or the number of machines. Azure will adjust that automatically, but if you go to, any premium plans that Azure has, this basically lets you have the flexibility of consumption where your app scales dynamically to hundreds of instances. But at the same time, you have the predictability of an app service plan where you know that you can have prewarmed instances that are always ready to go. So, you pay less of a cold start penalty that way.

As far as the option goes, Azure has three different sizes, which are going to give you a different number of CPU resources as well as memory resources. And you need to keep in mind that this is per instance. So, this can go to 100 instances and you can have 14 gigs of memory per instance if you need something like that. 

The next option would be monitoring, and this is basically representing the App Insights resource that gets created alongside your Azure function. And this is what Azure uses to monitor functions, so you can see your history of executions, and you can trigger alerts and metrics. You get one of these by default. And for most cases, it’s going to be free when you start going high on the data usage because you have a lot of traffic that you pay per the amount of data that you’re publishing to Application Insights. 

Next, you go into tags. Tags are what people used to, for example, add additional metadata on their resources. You can always tag your resource with the cost center, and the tags are propagated all the way down to your bill. So if you’re wondering how much this particular application is costing you that is using several Azure resources, tags is a good way to go.

Finally, you can go all the way to review and create and this is going to give you a summary of all of the things that will be created. So, you can see what description you’re targeting. You can see that you are creating a new storage account. You are creating a new App Service plan and you’re creating a new monitoring resource and in this case, Application Insights as part of the creation of your app. And when you click create, Azure is going to do the validation which basically checks to make sure that all of your inputs are proper and correct. There shouldn’t be anything that gets in the way of you creating this resource. If there was anything, Azure would flag it, and then it gives you an opportunity to correct it before you actually execute the creation.


Last Updated : 31 Mar, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads