How To Create And Test Azure Functions Using Azure Portal


Azure Functions is a solution for easily running small pieces of code in the cloud. We can create, execute, and test our custom logic function without creating a VM or web applications and also without needing to install any software or infrastructure to run the function. In this article, you will learn about creating and testing Azure Functions using Azure Portal.

Steps to create Azure Functions

Step 1

Navigate to and click on “Login to your account".

Azure Functions

Step 2

We should be following two ways to create Azure Functions -

  • Navigate to and provide Azure Functions details to create the Azure Functions.

    Azure Functions

  • Navigate to, click on "New" from Azure portal > Web + Mobile >click on see All or Search > Function App.

    Azure Functions

Step 3 Create Azure Functions App

Provide the Functions app name and fill in the following details for creating new Functions.

  1. App Name – Provide your Unique functions name
  2. Subscriptions – Select your subscription Free or any type
  3. Resource Group -create or select existing resource group name.
  4. Hosting Plan – You can Select default hosting plan as consumption plan, you have to pay only for the time functions code runs.
  5. Location – Select Your nearest location (eg. South Central US).
  6. Storage Account – You can Select or existing storage account.

Azure Functions

Step 4

Click on "Create" and wait for a few minutes to deploy the new Azure Function app.  Expand your new function app and click the + button next to Functions.

Azure Functions

Step 5

After clicking on + button, you will get the following screen. Select WebHook + API, choose a language for your function and click on "Create this function".

Azure Functions  

Step 6 Azure Functions Editor

The .csx file format allows you to write a C# function. Include any assembly references and namespaces at the beginning of the file as usual in C# and write your logic in Run method, just like below.

Azure Functions

Step 7 Run and Test Azure Functions

You can provide JSON string like the following in the request body and click on the "Run" button for testing the Azure Functions.

Azure Functions

Testing in Web Browser

The web browser is a simple way to trigger functions via HTTP. You can use a browser for GET requests that do not require a body payload and uses only query string parameters.

To test the function that we defined earlier, copy the Function URL from the Azure Functions portal like below.

Azure Functions

Append the name parameter to the query string. Use an actual name for the <Enter a name here> placeholder.

https://<Your Function App><Your Function Name>?code=<your access code>&name=<Enter a name here>, Paste the URL into your browser, and you should get a response similar to the following.

Azure Functions

Related Article

  1. Getting Started with Azure Functions Using Azure Free Trial Account


In this article, you learned how to create and test Azure Functions in Azure Portal. If you have any questions/ feedback/ issues, please write in the comment box.