Azure Function App

Introduction

After successfully creating a local Function App and getting our first function up and running, it is now time to create a Function App in Azure.

The Azure resources will be created using a Bicep template (you don't need to install any additional software).

Login to your Azure account

First we need to log in to our Azure account with the Azure CLI.

Login the Azure CLI:

az login
Sample output
A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize.
Please continue the login in the web browser.
If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.
Opening in existing browser session.
[
  {
    "cloudName": "AzureCloud",
    "homeTenantId": "some-tenant-uuid",
    "id": "your-subscription-uuid",
    "isDefault": true,
    "managedByTenants": [],
    "name": "you@sample.com",
    "state": "Enabled",
    "tenantId": "some-tenant-uuid",
    "user": {
      "name": "you@sample.com",
      "type": "user"
    }
  }
]

Note: If you have more than one subscription, use az account (list / set) to switch to the one you want to use.

Create a new Resource Group

A resource group is a container that holds related resources for an Azure solution.

You might want to change the location for the created resources to something close to you.

Check what locations are eligible with:

az account list-locations --query "[].name"

Create one with:

az group create --name rg-functions-demo --location westeurope

Note: It might take a while for the resources to show up in Azure Portal.

Creating the demo resources

The resources will be created in the same location you used for the resource group. However, not all resources are available for every resource. You can look up which products are available in which location here.

Download the template file from here.

Create the resources with:

az deployment group create --resource-group rg-functions-demo --template-file functions-demo.bicep

The following resources will be created:

  • A Function App is a serverless solution that allows you to implement your system's logic into readily available blocks of code.
  • A Storage Account contains all of your Azure Storage data objects, including blobs, file shares, queues, tables, and disks. In our case it's providing storage for our Function App.
  • An Application Insights instance is an extension of Azure Monitor and provides Application Performance Monitoring (also known as “APM”) features.
  • An App Service plan defines a set of compute resources for a web app to run. In our case it provides the execution environment for our functions.

Note: If you use an alternate language you need to update the Bicep template accordingly.