Unpacking and Demystifying Azure Function Apps: An Overview

Reading Time: 4 minutes

What is an Azure Function?

Azure Function Apps are Azure cloud-based serverless event-driven applications. Generally Azure Functions are stateless, meaning that each trigger or run of the Function App has no context or reference to previous runs. This isn’t a hard rule however, as there is an extension for something called Durable Functions, which allow you to provide a stateful design to your Function Apps.

Additionally, Azure Functions are scalable, so if your demand for execution increases, more resources will be automatically allocated to help service the requests.

Where would I use an Azure Function?

Some common use cases for Azure Functions are:

  • File processing
  • Calling backend jobs or returning backend outputs (e.g. calling a stored procedure)
  • Sending notifications or reminders
  • Simple web API tasks

Why use Azure Functions?

  1. Need something lightweight, serverless, and scalable
  2. Require an event triggered service
  3. On-demand execution
  4. Guarantee of 99.95% availability and is cloud-hosted
  5. Purely serverless with no infrastructure to maintain
  6. Low-cost and ease of use to debug, test, and deploy

What makes Azure Functions powerful?

The power in Azure Functions lie in the fact that they are serverless PaaS (Platform as a Service) offerings, meaning you don’t need to maintain server infrastructure. In addition to their serverless nature, Azure Functions support multiple languages:

  • C#
  • Java
  • JavaScript
  • PowerShell
  • Python
  • TypeScript
  • Go
  • Rust

Hosting Plans

Azure Functions provide you three major options when it comes to hosting in Azure.

  1. Consumption plan
    • Only pay for the compute when the Functions are triggered.
  2. Premium plan
    • Similar to consumption plans, but offer some valuable benefits such as pre-warmed workers to run your applications. This can be vital if your application is time sensitive and you don’t want it to suffer from cold-starts that occur in regular consumption plans. Some other befits include:
      • Virtual network connectivity
      • Unlimited execution duration
      • High-density app allocation
      • Premium size instances such as one core, two core, and four core
  3. Azure App Service plan
    • Run Functions in an App Service plan. This option is great if you would like to leverage an existing App Service plan that you already have deployed or if you want to provide a custom image on which to run your Functions.
Azure Function App Plans

Triggers

As mentioned previously, Azure Functions are trigger based, meaning they require some sort of event to run them. Azure Functions support four types of triggers:

  1. Queue triggers
    • When a message arrives in an Azure Storage Queue, it triggers the Function to run. This allows you to add multiple messages in queue.
    • When to use: a popular scenario for queues is if you plan on using your Function to call/run a service and you want to prevent a DDoS type situation, you can queue up your messages to slowly go through each call. It can also be helpful if you want to batch add multiple calls at once.
  2. Timer triggers
    • Trigger based on a timer event.
    • When to use: if you want to run your Function at a set day/time.
  3. Event Grid triggers
    • Using Event Grid to trigger your Azure Function App.
    • When to use: If you already have an Event Grid instance or would like to utilize event Azure service sources. Example event sources are:
      • Azure App Configuration
      • Azure Blob Storage
      • Azure Communication Services
      • Azure Container Registry
      • Azure Event Hubs
      • Azure IoT Hub
      • Azure Key Vault
      • Azure Machine Learning
      • Azure Maps
      • Azure Media Services
      • Azure Policy
      • Azure resource groups
      • Azure Service Bus
      • Azure SignalR
      • Azure subscriptions
      • Azure Cache for Redis
      • Azure Kubernetes Service (preview)
  1. HTTP triggers
    • Triggers a function based via a HTTP request. This allows you to build your own serverless APIs and respond to webhooks.
    • When to use: If you’re wanting to call an API, for example trigger your function by clicking a button on your website and calling an API request (GET, POST, etc.).

Tools to get started

Some popular tools you can use to develop your Functions Apps with are Visual Studio, Visual Studio Code, Command line, and building the Function App in Azure portal using your browser. If you aren’t sure where to start, my recommendation is to start with Visual Studio Code because it’s free and it a great IDE when it comes to local debugging, publishing to Azure, and remote debugging. VS Code also runs on Windows, macOS, and Linux!

So, where do I start?

I know it can be a little daunting trying to figure out where to get started if you want to build your first Function App. To help make it easier, I’ve created a Function App series where I walk through the basics of building your very own Function App. Check out part 1 of build your first HTTP trigger Azure Function App.

Summary

Azure Function Apps are a great solution if you’re looking for something serverless, lightweight, and scalable. What’s great about getting started with Azure Functions is that you can start running them locally, without incurring any costs. If you don’t have an Azure tenant and would like to get started for free, Microsoft gives you 12 months free with $200 of Azure credit.

Read more

Azure Functions Apps overview

Developer Guide

Leave a Reply

Your email address will not be published. Required fields are marked *