Creating first Azure Function using visual studio

In my previous articles we have accomplished following:

Creating Azure Function App in Azure portal
Adding function to an Azure function app in Azure portal

In this article we will create Azure function app using visual studio. I will be using Visual studio 2017 with .Net core 2.2 for this example.

Install Visual studio : Link
Install .Net Core 2.2 : Link

At the end of this article you will be able to successfully create your azure function app.

Create Azure Function using Visual Studio

1. Open Visual Studio and click on File Menu and select New and then Project .
2. In the New Project Dialog select "Visual C# Cloud" on left side and then choose Azure Functions.
3. Enter Name of your function project (FunctionAppDemo) and select the location and solution name.


4. Press OK.
5. On the next screen you will be asked to select a template for function app. You can select any template according to functionality you want to implement. For this article we will choose "Timer Trigger".


6. Click OK.
7. Open Solution explorer and check various components of our first function App.


8. Here is the explanation:
  • FunctionAppDemo is the name of our function app project
  • Function1.cs is the file where we will create our function and its related C# logic
  • host.json contains global configuration for a function app. A function app can contain multiple functions. So any configuration which needs to be applied to all functions in a function app goes here.
  • local.settings.json file stores app settings, connection strings, and settings used by local development tools. Settings in the local.settings.json file are used only when you're running projects locally.
9. Right click on FunctionAppDemo project and build it.

That's it our first function app is ready.

In next article we will see how to publish a function from visual studio to cloud.

Comments