In the previous article, we discussed Azure functions and their features, and we also created an Azure function using Azure Portal. This is the second article in the Azure Functions series. In this article, we are going to discuss how we can simply create an Azure function using Visual Studio 19, and then we will deploy the same function to the Azure function app from Visual Studio.
Azure Functions in C# for Beginners series,
It is recommended to create an Azure function from Visual Studio or VS code so that we can write code in a proper way. We can create a C# #-based Azure function from Visual Studio. In this article, let's create a simple HTTP-based Azure Function.
Create Azure Function Using Visual Studio
Prerequisites
- Visual Studio 19 with Azure Development workload
- Azure account (If you don't have an Azure subscription, create a free trial account)
So open Visual Studio and Go to File -> New -> Project. Search "Azure Functions" in the search box select the Azure function template and click on Next.

Give a name to the function project and click on Create.

Select the HTTP trigger template set the Authorization level as Anonymous and click on Create.

To restrict the use of your function we can set the Authorization level. There are three types of levels available: 1] When we set levels as Function, then we have to provide a function key to call our function. 2] When we set it as Admin, then you need to provide the master key. Both the function key and admin keys are found in the 'keys' management panel on the portal when your function is selected. 3] When we don't want any authorization then we can simply set the level as Anonymous.
That's it. We have created our first Azure function. Open the Function1.cs file to see the generated function.

Now to run the function just run the project. It will then start Azure function cli to run the function.

The function is running on 'http://localhost:7071/api/Function1' after looking at the default function code written which accepts the name from the query string or from the request body appends the name to the Hello string and returns the output.











Dave SauerPosted Jan 13, 2023, 2:58 PM
Ok, now consider that I have a second different function named function2 and I want to also publish that under the function-app-sk function app so that the Azure Portal shows me 2 functions with names function1 and function2. What are the steps to publish function2 so that it does not overwrite function1? Thank you.
Yogesh VedpathakPosted May 2, 2021, 5:31 PM
very nice ...