5 simple steps to create and test your first Azure Function App

By | May 17, 2017

Azure Functions let us execute our code in a serverless environment. This does not require create a solution or publish it as Azure Apps. In short, just focus on code and your functional aspect, and don’t need to worry about infrastructure. Azure Function, can be used in different business scenarios and with different integration aspects. In this post let’s try and create a basic Azure Function from Azure portal.

Step 1- Create Azure Function App

Navigate and Login to your Azure Portal

From New ->  Compute ->  Select Function App, or Search Function App in the Search the marketplace box

newfunctionapp

Fig: Select Function App service in Azure Portal

 

Then Create the Function App, by providing all required details including App Name, Subscription Details, Hosting Plan etc. 

 

FunctionApp

 

Fig: Create new Function App

It may take a while to provision a new Function App. Once the process is completed, you will have the following screen:

FunctionAppCreated

Fig: Function App is Created

Step 2 – Add New Function in Function App

Add a New Function, by clicking on the “+” icon in the Function option

 

CreateNewFunction

Fig : Adding a new function in Function App

Selecting New option would launch the quick start page from where you select some predefined scenarios such as Web Hook + API , Timer and Data Processing along with Language – “ C# or Java Script.

 

CreateNewType

Fig: Select type of function

You can also create your own custom function too. For now, select the Webhook + API and C# language and click the “Create this function” button

Step 3 – Function Code / Write Your Custom Code

With that you will find a default HttpTrigger function created. That function is nothing but a self-contained method which accept a HttpRequestMessage and return HttpResponseMessage.

 

FunctionRunning

Fig: Function Code and Run it

You can run the function, and pass a test parameter to test it out. This code is just an example comes with the template that we choose, where you can see without worrying of solution or other infrastructure, we can run a module.  You can write you custom logic, use them with in a function and access them for an external application.

Step 4- Test Your Function

Click on the </> Get Function URL button in the top-right corner, it will show you the Function URL.

 

GetURL

Fig : Get the Function URL

Use the URL from any of your client application and pass the required parameter! Following screen shots shows using the Azure Function from Postman Client.

RuninPostMan

Fig: Testing your Azure Function

You can also use this URL and integrate with your custom app and call the as like other end points.

 

Step 5 – Monitor your Function Invocation

Select the Monitor Tab in the tree, to view details of Invocation Log for your function

 

monitorFig: Azure Function Monitoring

This post just talk about initial introduction of Azure Function, and how to create you first Azure Function. In the next few post we will discuss some more details on Azure Functions.

Hope This helps !

One thought on “5 simple steps to create and test your first Azure Function App

  1. Pingback: Real Time Telemetry for your Azure Function App using Application Insights

Comments are closed.