Azure functions are a serverless computing service, which is hosted on Microsoft Azure cloud. It is designed to help simplify application development, wherein, we concentrate only on the piece of code that matters to us.
Azure functions allow us to write code and maintain less infrastructure and save cost. It helps in performing tasks like image processing, processing orders, file maintenance, and running scheduled tasks.
In this article, we are going to create a simple Azure function, which will help beginners, how to start working on Azure functions.
Open Visual Studio, and create a new project “Azure Functions”
Give it a name on the next screen
Select the HTTP trigger template and create the project
The project is created and it opens the default function. This is what our default function looks like.
Let’s change it a bit to remove extra lines and just return “Hello World!”, notice that I changed the class and function name a bit.
Right-click on the solution, and rebuild the project to make sure no error.
Run it from top button or using F5 (with debug) or Ctrl + F5 (without debugging)
The function will run and CLI opens showing where to trigger the function
You can copy this URL and type in browser, shows the response that we returned
Notice the default port used by azure functions is 7071, if you wish to change it, you can go to project properties, and use “start –port 7000”
Run the app again
That's it. our first Azure functions app is ready. In our next article, we will learn, how to publish Azure functions.