What are Azure Functions?

Azure Functions are Azure’s server less product. The idea is that you bring your code and Azure manages the infrastructure underneath it. Functions scale automatically with demand when hosted on a “consumption plan”.

Functions can be triggered by a HTTP request, but can also be triggered based on a timer or a variety of Azure resources. (for example Azure Service Bus)

What would you use Azure Functions for?

The documentation states:

Functions is a great solution for processing data, integrating systems, working with the internet-of-things (IoT), and building simple APIs and microservices. Consider Functions for tasks like image or order processing, file maintenance, or for any tasks that you want to run on a schedule.

https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview

So what wouldn’t you use them for?

This is the much more interesting question to ask. Many treat Functions as a hammer that can work for any workload and to an extend Functions can do that, but that doesn’t mean that they should.

Long running jobs

Functions that run in a premium plan can be configured for unbounded execution. Functions running on a standard plan are limited in terms of their execution time and memory allocation.

Even if running on a premium plan, you may want to explore other products for batch executions based on your workload. (for example: if your workload is memory and CPU intensive, you may be better off using Azure Batch, as your job will complete much sooner overall)

Stateful Websites

While hosting an entire website in a functions app is definitely possible, it’s not a great idea a lot of the time.

Functions do not persist state, so any actions need to be stateless anyway. Additionally the consumption plans are designed to charge on a per-execution basis.

Durable Functions

Durable Functions are an extension to standard Azure Functions. They allow you to define stateful workflows.

The reason durable functions is on the list is that I have seen people implement the same principal in a proprietary fashion. In 99% of cases you are better off using what the platform provides here.

Durable functions save their memory and restore it when they come back up, meaning that you can create workflows of functions or patterns where a function is watching an ongoing process.