Azure Durable Functions: Benefits, Types, and Patterns

4.2/5 - (69 votes)

In this blog, we are going to cover What is Azure Durable Functions, the Benefits, Patterns, and Types of Durable Functions, and how to Create Durable Functions.

The topics covered in this blog are:

What is Azure Durable Functions?

Azure Durable Functions is an extension of Azure Functions that enables you to write stateful functions in a serverless computing environment. The extension enables you to define stateful workflows by writing orchestrator functions and stateful entities by creating entity functions using the Azure Functions programming style.

Behind the scenes, the extension maintains state, checkpoints, and restarts for you, letting you concentrate on your business logic.

Why Azure Durable Functions?

This is really vital to know, why we should go with the Azure Durable Functions? There are certain things that are difficult to accomplish with the standard Azure Function.

So, here are the Durable Functions that assist us in doing various tasks such as defining the workflow in your code, implementing error handling in the code with the assistance of workflows, triggering parallel execution, and so on.

Azure Durable Functions are stateful in nature that helps to monitor the status of the workflow at each step. This also helps to build some complicated (workflows) procedures for our business because of its stateful nature.

Supported Languages for Durable Functions

The following languages are presently supported by Durable Functions:

  1. C#
  2. JavaScript: Version 1.7.0 or later of the Durable Functions extension is required.
  3. Python: Version 2.3.1 or later of the Durable Functions extension is required.
  4. F#: The Azure Functions runtime version 1.x only supports F# scripts.
  5. PowerShell: Only version 3.x of the Azure Functions runtime and PowerShell 7 are supported.

Azure Durable Function Types

There are four types of Azure durable functions in Azure Functions: activity, orchestrator, entity, and client.

1. Orchestrator Functions

Orchestrator functions explain how activities are carried out and in what sequence they are carried out. An orchestration can contain a variety of actions, such as activity functions, sub-orchestrations, HTTP, waiting for external events, and timers. Orchestrator functions can communicate with entity functions as well.

2. Activity Functions

Activity function is called as the basic unit of work in a durable functions orchestration that executes one task. Activity functions are the tasks that are orchestrated in the process. You can call many activity functions within the orchestration function. Each one of the Activity functions executes one task.

Unlike orchestrator functions, activity functions aren’t limited in the type of work you can undertake in them. Activity functions are typically used to make network calls or perform CPU-intensive tasks.

3. Entity Functions

Entity functions describe operations for reading and updating tiny chunks of state. These stateful entities are also referred to as durable entities.  Like orchestrator functions, entity functions have a unique trigger type called an entity trigger. They can also be invoked from client functions or from orchestrator functions. Unlike orchestrator functions, entity functions have no special code constraints.

4. Client Functions

Entity functions are triggered by an entity trigger binding while orchestrator functions are triggered by an orchestration trigger binding. Both of these triggers work by responding to messages that are enqueued into a task hub. The main approach to send these messages is by utilizing an orchestrator client binding or an entity client binding from within a client function. Any non-orchestrator function may be a client function.

Also Read: Our blog post on the Azure Certification path in 2023

Azure Durable Function Patterns

1. Function Chaining

The pattern of running a succession of functions in a certain order is referred to as function chaining. Often the output of one function needs to be applied to the input of another. Azure Durable Functions enables us to implement this pattern in code in a concise manner.


2. Fan-out/Fan-in

Fan-out/fan-in refers to the pattern of performing numerous functions in parallel and then waiting for all to complete. Often some aggregating work is done on results received from the functions. With standard functions, fanning out may be done by having the function send numerous messages to a queue. However, fanning back in is far tougher.  We’d have to write code to keep track of when queue-triggered functions finish and where the function outputs are stored. This pattern is handled by the Durable Functions extension with relatively simple code.


3. Async HTTP APIs

The async HTTP API pattern solves the difficulty of coordinating the status of long-running activities with external clients. A popular approach to implement this pattern is by having an HTTP endpoint trigger the long-running action. Then, redirect the client to a status endpoint that the client polls to know when the action is done.


Azure Durable Functions provide built-in APIs for interacting with long-running function executions, which simplifies the code we write.

4. Monitor

The monitor pattern refers to a flexible repeating process in a workflow – for example, polling until particular criteria are fulfilled. A typical timer-trigger can solve a simple scenario, such as a periodic cleanup job, but its interval is fixed and managing instance lifetimes gets difficult. Durable Functions allows task lifetime management, flexible recurrence intervals, and the ability to create numerous monitor processes from a single orchestration.


5. Human Interaction

Many automated processes need human interaction in some way. Involving humans in an automated process is challenging since people aren’t as easily available and as responsive as cloud services. An automated process might allow for this interaction by employing timeouts and compensating logic.


Also Check: Our blog post on Azure Application Gateway

When to Use Azure Durable Functions

In many circumstances, you can utilize the Durable Functions. So here are some key requirements when you can move with the Azure Durable Functions.

  • When you need to create a workflow along with the Azure Function. In this scenario, you can use the Azure Durable functions which helps you to write the workflow from the code, and you can able to write complex approval workflows where you can also implement a timeout in case of extreme delays from the approver side, and you can also send a reminder notification to the approver to approve the workflow, and so on.
  • If your requirement is to work for the recurrence intervals then you can use it.
  • If you want to manage the task lifetimes you can use it.
  • If you want to work with multiple Azure Functions then you can use it.

Benefits of Azure Durable Function

There are many benefits of Azure durable functions.

1. Build Workflows in Code: Azure Durable Functions help us to build the workflows from our code effortlessly. That workflows help us to automate our business processes and also help us for error handling in our code which is really critical.

2. Parallel Activities: Azure Durable Function helps us to perform multiple parallel activities in case we are using multi-step workflows. It is very helpful to achieve complex workflows.

3. Workflow Time Out Option: In case of any huge delay in response, when executing the workflow, we can set the timeout option for the workflows quickly with the assistance of the Durable function.

4. Workflow Progress Tracking: Durable Function can enable us to monitor the status of a workflow easily with the help of the REST API. we can use the query status API to track the workflow progress simply.

Also Read: ADF interview questions

How to Create Azure Durable Function

1. Log in to the Azure Portal and search for the Azure Function App under the Compute Section.

How to create Azure Durable function

2. After successfully creating the Azure Function services, you are moved over to the overview. Then click on Function.


3. Now, click on the Create button to create a function trigger.


4. Now, on the next page, search for the durable function in the search box and choose the HTTP starter durable function from the list, and set the name as the starter.


5. Now, we need to create an orchestrator durable function. To do that, go to the function section and click on the create button. After that, search for the durable function orchestrator in the search box and then choose the function and set the name as Flow1 and click on the create button.

6. Now, we need to create an Activity durable function. To do that, go to the function section and click on the create button. After that, search for the Durable function Activity in the search box and then choose the function and set the name as Activity and click on the create button.

7. Copy the starter function URL and paste it in the postman tool and change the function name as Flow.


8. Now, copy the get URI and paste it into the next tab and click on the send button. The Azure durable function is working successfully and you can see the final output in the below image.


Read More: About Azure Recovery Services Vault

Azure Durable Functions Limitations

There are a few Limitations of Azure durable functions.

  1. You will have to be very much attentive during updating the Azure Durable function app code. It could disrupt the typical functionality of the Azure
  2. It’s tough to generate guides or random numbers.
  3. It’s very difficult to implement Thread.Sleep.
  4. You cannot call the non-deterministic APIs from the Azure Durable Functions.

Azure Durable Functions Pricing

The pricing of Azure Durable Functions is the same as Azure Function Pricing.

Azure Durable Functions Pricing


In this Azure tutorial, we discussed What is Azure Durable Functions, how to create Durable Functions in Azure, benefits, types and much more.

I hope you have enjoyed this article!!!


Q1. What are Azure durable functions?

Azure Durable Functions are an extension of Azure Functions that provide an event-driven programming model for building scalable and stateful workflows. They allow developers to write long-running, durable workflows using familiar code constructs such as functions, loops, and error handling.

Q2. How long can a durable function last in Azure?

The duration of a durable function in Azure depends on the underlying orchestration framework settings and the type of hosting plan. By default, the maximum execution duration is limited to 5 days. However, this can be extended by modifying the function’s timeout settings.

Q3. What is the difference between Azure durable functions and logic apps?

Azure Durable Functions and Logic Apps are both workflow orchestration tools in Azure, but they have different design focuses. Durable Functions are code-centric, allowing developers to write workflows using functions and coding constructs. Logic Apps, on the other hand, provide a visual designer for building workflows using a range of pre-built connectors and actions.

Q4. What is the difference between function and durable function?

The main difference between a regular Azure Function and a Durable Function is their execution model and statefulness. Regular functions are stateless and short-lived, triggered by events and executed independently. Durable Functions, on the other hand, are long-running and stateful, maintaining their execution state across multiple function invocations.

Q5. How do you trigger a durable function?

Durable Functions can be triggered in various ways, such as through HTTP requests, timers, queues, or external events. The triggering mechanism depends on the type of durable function (orchestrator, activity, or entity function) and the desired workflow logic. Triggers can be defined using attribute-based annotations or configured in the function’s code.


Sharing Is Caring:

Sonali Jain is a highly accomplished Microsoft Certified Trainer, with over 6 certifications to her name. With 4 years of experience at Microsoft, she brings a wealth of expertise and knowledge to her role. She is a dynamic and engaging presenter, always seeking new ways to connect with her audience and make complex concepts accessible to all.


Leave a Comment