How Azure Functions works

Completed

Here, you’ll learn about how you can use Azure Functions to develop serverless architectures and make use of the various feature implementations provided by Functions.

You’ll also learn more about how Azure Functions work. This will also help you determine how you can best use Azure Functions to meet your organization's requirements.

Azure Functions is a serverless compute solution that allows you to write less code. It’s a Platform as a Service offering so you don’t have to worry about hosting your app, and you save on costs.

Azure Functions is a great solution for processing data, integrating systems, working with the internet-of-things (IoT), and building simple APIs and microservices.

Scaling function apps

The context in which your functions run is called a function app. A function app is a unit of deployment, management, and scale for your functions. All function in a function app share the same setting and connections.

In the Consumption and Premium plans, Functions scales CPU and memory resources by adding more function app instances. The number of instances is determined based on the number of events that trigger a function. All functions within a function app share resource within an instance and scale at the same time.

Azure Functions monitoring

Azure Functions offers built-in integration with Azure Application Insights to monitor functions. Application Insights collects log, performance, and error data. It helps you detect performance anomalies, diagnose issues and better understand how your functions are used.

Application Insights instrumentation is built into Azure Functions. With Application Insights integration, telemetry data is sent to your connected Application Insights instance. This data includes logs generated by the Functions host, traces written from your functions code, and performance data.

Note

In addition to data from your functions and the Functions host, you can also collect data from the Functions scale controller.

The following image shows an example of how to view data in Application Insights for a Function App.

Screenshot showing Monitoring telemetry data for Azure Functions

Azure Functions Components

The following table describes the key components of Azure Functions:

Component Description
Function triggers Triggers are what cause a function to run. A trigger defines how a function is invoked and a function must have exactly one trigger.
Function bindings Binding to a function is a way of declaratively connecting another resource to the function; bindings may be connected as input bindings, output bindings, or both. Data from bindings is provided to the function as parameters. If you don’t want to or can’t use bindings, you can still use a client SDK in your functions as you normally would when connecting to services.
Function runtime Azure Functions currently supports several versions of the runtime host. Functions also support many different runtimes such as .NET Core, Node.js, Java, PowerShell and Python. During development, you can install the Functions runtime on your local computer and run functions locally by using the Azure Functions Core Tools.
API Management APIM provides security and routing for your HTTP triggered function endpoints as a way to expose them as a true REST API.
Deployment slots Azure Functions deployment slots allow your function app to run different instances called "slots". Slots are different environments exposed via a publicly available endpoint. Slots provide a way for you to test a new version of your functions in Azure in a safe environment and then seamlessly swap the new version into production.
Function app configuration Connection strings, environment variables, and other application settings are defined separately for each function app. The function app settings values can be read in the code as environment variables.

These components work together to provide a complete end-to-end platform for Application and DevOps Engineers to develop Serverless Architectures leveraging Azure Functions.

Check your knowledge

1.

How many triggers does an Azure Function have?