Getting Started With Azure Functions Using Azure Free Trial Account

Introduction

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. You can use the development language of your choice, such as:

  • C#
  • F#
  • JS
  • Python
  • PHP

Users have to pay only for the time their code runs. Azure Functions let you develop serverless applications on Microsoft Azure. In this article, you will learn how to create Azure Functions without creating an Azure account.

How to create Azure Functions

Step 1

Navigate to https://functions.azure.com and click on "Try It For Free".

Azure Functions

Step 2 Create Azure Premade function

  • Choose the functions scenario (WebAPI/timer/Processing),
  • The free trial will allow only two languages (C# and JavaScript), select your Language, and click on "Create this function".

    Azure Functions

Step 3

Login with any of the following providers without creating an Azure account.

Azure Functions

Step 4 Azure Function Editor

Azure Functions
Azure Functions Edit has the following features:

  1. Microsoft Azure free trial Functions Edit gives access only for 60 minutes.
  2. You can edit C# Azure function in Run.csx file as per your requirement.
  3. Save the changes.
  4. Run the Functions.
  5. "Get Function URL" button will provide the public function's URL.
  6. "View File" button for the list of files will display.
  7. "Test" button is for testing the function.

View File window

You can add and upload a file using the File Explorer window and the system will generate two files, functions.json for configuration and run.csx file for creating Cc# custom method.

Azure Functions

Run.csx file

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

function.json File

The function.json file defines the function bindings and other configuration settings, like how to pass data into and return data from function execution. The name is used for the bound data in the function. For C#, this is an argument name; for JavaScript, it's the key in a key/value list.

You can refer the following example function.json file.

Azure Functions

Test the Function

You can test Azure Functions in multiple ways. Here, I will explain two ways to run and test an Azure Function Editor and test with the Browser.

You can provide JSON string like the following in the request body and Click on the Run button for test the Azure Functions

Azure Functions

Test with a 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 that use only query string parameters.

To test the function we defined earlier, copy the Function Url from the Azure function 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>.azurewebsites.net/api/<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
The Chrome browser will return the string in XML. Other browsers display just the string value.

Summary

In this article, you learned about Azure Functions, how to create Azure Functions, how to create Azure account, and test Azure Functions. 

If you have any questions/ feedback/ issues, please write in the comment box.


Similar Articles