Basics of Azure Function App in .Net 6.0

Posted on March 9, 2023
azureazurefunctionazfunc-seriesserverless

Azure Function App

Azure Function App is considered a serverless compute service because it allows developers to write and deploy code without worrying about the underlying infrastructure.

Generally, when building and deploying applications, developers have to manage the infrastructure where their code runs, including servers, operating systems, and networking components. This is could take time and complex tasks for developers, especially when scaling up or down the infrastructure to handle demand in applications.

Developers only need to write code and define triggers that will execute it. Azure will take care of preparing infrastructure and scaling up and down.

Prerequisite

Azure Storage Explorer

Azure Functions Core Tools

Triggers/Bindings in Azure Function App

A trigger is responsible for initiating the function execution, whereas a binding provides input and output data to the function. Here are some examples of triggers/bindings in Azure Function Apps:

Blob Trigger: This trigger is used to execute the function when a new blob is added or deleted from an Azure Blob Storage container.

Queue Trigger: This trigger is used to execute the function when a message is added to an Azure Storage Queue.

HTTP Trigger: This trigger is used to execute the function when an HTTP request is sent to the function's URL.

Timer Trigger: This trigger is used to execute the function on a schedule.

Cosmos DB Binding: This binding provides input/output data to the function from/to an Azure Cosmos DB collection.

Service Bus Binding: This binding provides input/output data to the function from/to an Azure Service Bus queue or topic.

Event Grid Trigger: This trigger is used to execute the function when an event is published to an Azure Event Grid topic.

Create a Basic Function App in C# using HTTP Trigger

Using Visual Studio
  1. Go to File -> New -> Project
  2. Select Azure function Template then select "Next"
  3. Configure your project with the name of the project then select "Next"
  4. Enter Additional Information (see screenshot)
Or Using Azure Functions Core Tools
  1. Install Azure Functions Core Tools
  2. Open the command prompt as administrator
  3. enter command -> func init (see screenshot)
func init
  1. Select the worker run time.

func init

Running Azure Function App

Hit f5 and wait for the following screen to appear.

output function

HTTP Trigger through GET/POST

HTTP Trigger through GET/POST

See how we can deploy Azure Function App in this article

Thanks for reading!


Posted on March 9, 2023
Profile Picture

Arun Yadav

Software Architect | Full Stack Web Developer | Cloud/Containers

Subscribe
to our Newsletter

Signup for our weekly newsletter to get the latest news, articles and update in your inbox.