Introduction

In this lesson, we’ll learn about another essential hosting service: Azure Functions (Function Apps).

Azure Functions are serverless services that enable software developers to quickly build computing logic without focusing on the infrastructure. Serverless means that there is compute allocated for the Azure Functions, but rather the processing capacity is assigned on demand, which makes Azure Functions a very cost-effective option.

We can design Azure functions to respond to various action triggers, such as HTTP requests, schedules, or external events. This reactive nature of Azure functions makes them an attractive option for many applications, such as integrated systems and the Internet of Things (IoT).

Benefits of Azure Function Apps

There are benefits of using Azure function; these benefits include:

  • Support for a wide range of programming languages, including C#, Java, JavaScript, and Python.
  • Native integration with miscellaneous Azure services and external parties such as Cosmos DB and Twilio APIs.
  • Automatic scaling capabilities to meet increasing demand.
  • Support for various triggers such as HTTP endpoints, schedules, and events.

Types of Azure Functions hosting options

  • Consumption plan: This is the default option of Azure functions. It scales automatically, and you’ll pay for what you use. Function hosts (the underlying compute resource) are added and removed automatically based on the incoming events.

  • Premium plan: Automatically scales demand using preworked compute resources, which makes your application respond without delay if there were idle for a while. Supports virtual networking (VNETs) connectivity (VNETs are networking concepts in Microsoft Azure, they are outside the scope of this course).

  • Dedicated plan: Run your application using the regular App Service Plans we examined in the previous lesson. Suitable if you already have existing underutilized App Service Plans.

Creating our first Microsoft Azure Function App

In this tutorial, you’ll create your first Microsoft Azure Function App. For that, we will use Azure CLI instead of Azure portal.

The terminal below will provide you access to Azure CLI. But before executing the commands, please note the environment variables the terminal needs:

  • subscriptionId: This is the ID of your trial Azure subscription—please fill it.
  • location: This is the location in which you will deploy your resources. Keep it as it is, or fill in whatever you like.

Note: enter the region name without spaces.

  • resourceGroup: This is the name of the resource group where we will deploy our resources. Keep it as it is, or fill in whatever you like.
  • functionApp: This is the name of the Azure Function. This name will be a part of the URL to access your application via the web. It should be globally unique. Fill it with a unique value without special characters.
  • functionAppStorageAccount: This is the name of the Storage Account. This name will be a part of the URL to access your application via the web. It should be globally unique. Fill it with a unique value without special characters. The storage account name must be between 3 and 24 characters in length and user numbers and lowercase letters only.

Get hands-on with 1300+ tech skills courses.