
In this Azure tutorial, we will discuss What Are Azure Durable Functions. Along with this, we will also discuss a few other topics like Why Durable Functions, Supported Languages for Durable Functions, Key Benefits of Durable Functions, and we will also discuss Different Patterns Of Durable Functions, When To Use Durable Functions, How To Create Durable Functions Using Visual Studio 2019.
What Are Azure Durable Functions? Azure Durable Function is an extended version of Azure Function that helps us to develop stateful functions in a serverless environment and to develop stateful workflows using the code with the help of a different type of function called an orchestrator function.
Table of Contents
- What Are Azure Durable Functions
- Azure Durable Functions Tutorial
- Serverless
- Why Durable Functions?
- Main Components for Durable Functions
- Key Benefits of Durable Functions
- Different Patterns Of Durable Functions
- When To Use Durable Functions
- Different ways to Develop Durable Functions
- How To Create Durable Functions Using Visual Studio 2019
- How to Enable Durable Functions
- Azure Functions VS Durable Functions
- Durable Functions VS Logic Apps
- Azure Durable Functions VS AWS Step Functions
- Durable Functions Limitations
- Azure Durable Functions Pricing
- Wrapping Up
What Are Azure Durable Functions
So, Before we start the discussion on What are Azure Durable Functions, you should know What is Azure Function.
Azure Durable Functions Tutorial
As we have discussed above, Azure Durable Functions is an extension of the Azure Functions. Compare to the Azure Functions, Azure Durable functions are more capable in terms of different functionality, Performance, etc.
It is obvious that the Azure Durable functions are capable of doing what an Azure Function can able to do with many extra features to automate the business process. Working with the Workflow from code becomes easy with the help of Durable functions.
Serverless
As we already know that, Azure functions are part of the serverless architecture meaning just we need to concentrate on writing the Function code with out taking any headache for the Infrastructure.
While deploying our Azure function to Azure, No headache for us thinking on the Infrastructure part, even we don’t have to define explicitly, how many servers we want to execute our Azure Function. Thanks to the Azure Function runtime that really helps us to define the number of servers e need and it helps us to handle the Overall load.
Why Durable Functions?
This is very important to know, Why we should go with the Durable Functions? There are stuffs that are difficult to implement with the regular Azure Function.
So, here is the Durable Functions that helps us to perform many activities like if you want to define the workflow in your code if you want to implement the error handling in the code with the help of workflows, if we want to trigger the parallel execution, etc
Durable Functions are stateful in nature that helps to track the status of the workflow in each stage. This also helps to implement some advanced workflows for our business because of the stateful nature.
Supported Languages for Durable Functions
As of now below are the languages that are supported to build Durable Functions
- It supports C# language
- Durable function version 1.7.0 or later is supported by the Azure Function runtime version 2.x.
- Durable function version 1.8.5 or later version supports Python.
- Function version 1.x supports F# script.
- The durable function version 2.2.2 is supported with PowerShell and it supports the Azure function version 3.x. Currently in Public Preview.
Main Components for Durable Functions
You can consider the below concepts as the main components for the Durable Functions. Those play a vital role while working with the Azure Durable Function
- Orchestrator Client
- Orchestrator Function
- Activity Function
Orchestrator Client
The Orchestrator client starts and stops the orchestrator functions and it takes the responsibility to monitor them. When you are creating an HTTP triggered function initially, You can call that HTTP triggered function as the Orchestrator Client. This is responsible to get the request and then it starts the orchestrator function. So this is the first step in the whole process.
using Microsoft.Azure.WebJobs.Extensions.DurableTask;
using Newtonsoft.Json;
using System.Net;
[FunctionName("Function1")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, IDurableOrchestrationClient starter,
ILogger log)
{
Orchestrator Function
The Orchestrator Function plays a major role while building the Durable function and Orchestrator Function is considered to be the heart of the durable function solution. In this function, you need to write the workflow in code. You can call the Activity function from the Orchestrator Function inside the code. You can also call another Orchestrator Function and Sub Orchestrator Function from this main Orchestrator Function.
Activity Function
Activity Function is called as the basic unit of durable function that executes one task. You can call many activity functions inside the orchestration function. Each one of the Activity function executes one task.

Key Benefits of Durable Functions
There are many benefits of durable functions. There are a few key tasks that we cannot able to perform with the help of the regular Azure Function, we can able to perform those tasks easily with the help of the Durable functions. Let’s discuss a few key benefits of the Durable functions in terms of the Workflow.
Build Workflows in Code
With the help of the Durable Functions, we can able to build the workflows from our code comfortably. That workflows help us to automate our business processes as well as help us for error handling in our code which is very important.
Parallel activities
The azure function can help you to perform multiple parallel activities in case you are using the multi-step workflows. That really helps to achieve the complex workflows.
Can Implement the Time Out Option in Workflow
In case of any major delay in response, while running the workflow, you can set the timeout option for the workflows easily with the help of the Durable function.
Track the Workflow Progress Easily
Durable Function can help you to track the progress of a workflow easily with the help of the REST API implementation. You can use the query status API to track the workflow progress easily.
Easy Cancellation of the Workflow
You can easily cancel the in-progress workflow with the help of Rest API with a Durable function. It was not at all easy with the regular Azure Functions.
Different Patterns Of Durable Functions
Multiple Function execution
The durable function helps you to execute a sequence of functions i.e the chain of function easily. When I am saying the chain of function meaning the functions will execute sequentially. The OutPut of the first function will be the input for the second function and again the output of the second function will be the input for the third function.

Supports Fan out/fan in
Durable Function supports the Fan-out/fan-in pattern. You might be wondering what exactly the meaning of the Fan-Out/fan-in pattern. As per this pattern, all the functions will execute in parallel and then waiting for all to finish.

Asynchronous HTTP APIs
The asynchronous HTTP APIs pattern is the problem of interacting with the long-running operations with the external clients. HTTP call helps us for this purpose. Durable functions have built-in APIs that help us to interact with the long-running function executions.
Monitoring
The next pattern for the Durable function is the Monitoring pattern that actually helps to enable the flexible recurrence intervals. It also helps to manage the lifetimes of the task and for a single orchestration, it creates multiple monitor processes.
Human Interaction
This is another excellent pattern from the Durable Function that helps us in case of business approval workflows. if you will consider the scenario where the approver is not available in case of the business approval workflow, This pattern helps to set the timeout, in case there is a huge delay in response. It also helps with sending the notification or reminder to the approvers in case of a delay in response from the approvers.
When To Use Durable Functions
In many cases, you can use the Durable Functions. So below are some key requirements when you can go with the Durable Functions.
- When you have a requirement to develop a workflow along with the Azure Function. You can use the Durable functions in this scenario that helps to write the workflow from the code and you can able to write the complex approval workflows where you can also implement the timeout in case of major delays from the approver side and you can also send the reminder to the approver to approve the workflow, etc.
- In case your requirement is to work for the recurrence intervals.
- If you want to manage the task lifetimes.
- If you have requirement to work with the multiple Azure Functions.
Different ways to Develop Durable Functions
There are different ways to develop or build Durable Functions. Below are the few relevant ways that you can use to develop Durable Functions.
Azure Portal
You can use the Azure Portal to develop Durable Functions. This is one of the best ways. You no need to install any software in your local machine and for you no need to take any headache for the infrastructure.
Visual Studio Code and other Command line Interface
You can use the Visual Studio Code editor or the other command line interface to develop the Durable functions.
Visual Studio IDE
You can also use Visual Studio, one of the excellent IDE for the development of Durable functions. Here you will get the Debugging options, Intelligence support that really makes the development experience easier. You will definitely enjoy working with Visual Studio. You need to install the Azure development workload and Azure Functions and WebJob Tools Visual Studio extension along with the Visual Studio.
How To Create Durable Functions Using Visual Studio 2019
Well, Here we will discuss How to create the Durable Functions using Visual Studio 2019. Follow the below steps to create Durable Functions using the Visual Studio 2019.
Open the Visual Studio 2019 from the local machine. Click on the Create a new Project button.
Select the Azure Functions project template and then click on the Next button.

Now provide a project name and choose a location for your project and then click on the Create button.

On the next window, select the HTTP trigger, select the Storage Account (AzureWebJobsStorage) as Storage Emulator and then choose the Authorization level as Function. Finally click on the Create button.

Now it will create the Project successfully. It contains 3 main files. Function1.cs file, which is the main class file that contains the Azure Function code. The next one is local.settings.json file, that is responsible to keep all the configurations that we need during the development of the project and testing the function in the local environment. The Host.json file is responsible to keep all the configuration related to your Azure Function. See below, the project created successfully with all the three files

Below is the Azure Function code

You can see below the code for the local.settings.json file

Finally, You can see the below code for the host.json file
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
}
}

Now our Azure Function project is ready, the next step is we need to enable the Durable Function options by enabling the Durable Function extensions.
How to Enable Durable Functions
Now in order to enable the Durable Functions, we need to add the Microsoft.Azure.WebJobs.Extensions.Durable Task nuget package to the Project.
Right click on the Project and then click on the Manage NuGet Package

Now search for the Microsoft.Azure.WebJobs.Extensions.DurableTask nuget package and then click on the Install button.

Now the next step is, click on the I Accept button to accept the license agreement.

Now if you will click on the .csproj file by clicking on the Project name, you can find the reference has been added for the Microsoft.Azure.WebJobs.Extensions.DurableTask nuget package

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.3.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.36" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
Now our Durable function project is ready, Let’s check if the function is working as expected. press F5 to run the Project. You can able to see, i got the Azure Function URL as below.
http://localhost:7071/api/Function1

Now Open your Favorite browser and paste this URL appending the name value with the query string parameter, You can able to see i got the expected out as below.

Azure Functions VS Durable Functions
Let’s discuss a few key differences between Azure Functions and Azure Durable Functions.
Azure Functions | Azure Durable Functions |
Azure Function is an Azure Service from Microsoft that actually helps you to run some pieces of code smoothly without getting worried about the infrastructure for your application. | Azure Durable Function is an extension of the Azure Functions. Azure Durable functions are more capable than Azure Functions in terms of different functionality, Performance, etc. |
Azure Function is stateless in nature. | Azure Durable Function is stateful in nature. |
Azure Functions are less efficient compare to Azure Durable Functions. | Azure Durable Functions are more efficient and can be used to create complex workflows. |
Durable Functions VS Logic Apps
Let’s discuss a few key differences between Azure Durable Functions and Logic Apps.
Azure Durable Functions | Logic Apps |
Azure Durable Function is an extension of the Azure Functions. Azure Durable functions are more capable than Azure Functions in terms of different functionality, Performance, etc. | Logic Apps are logical containers for different workflows that you can define using the triggers and different actions. |
Azure Durable Functions works with Imperative programming language pattern. | Where as, Logic Apps works with Declarative Code pattern. |
You can use C#, F#, JavaScript(Preview), etc for the development activity. | You can use Visual Studio or Visual designer from Azure Portal while developing the workflow. |
You can able to develop the workflow while you are offline. | Not possible to work with workflows while you are offline. You must be online and need to access to Azure in order to develop workflows. |
There is no life span limit for an instance of an Azure Durable function. | One instance of a logic App can run up to 90 days. |
You can able to deploy the Azure Durable Functions on your on- premises, Azure, Azure stack, etc. | You can only able to run the Logic Apps on Azure. |
You can run a business workflow in Azure using the Logic App service. Moreover, the Logic App is a logical container for one workflow you can define using triggers and actions.
Azure Durable Functions VS AWS Step Functions
Let’s discuss a few key differences between Azure Durable Functions and AWS Step Functions.
Azure Durable Functions | AWS Step Functions |
Azure Durable Function is an extension of the Azure Functions. Azure Durable functions are more capable than Azure Functions in terms of different functionality, Performance, etc. | AWS step functions are server less functions that helps you to sequence AWS lambda functions quickly. It also helps you to create complex workflows for business critical applications. |
Durable Functions Limitations
As, we have already discussed, there are so many benefits that the Azure durable function provides us. With the benefits, there are also a few key constraints with respect to code. Let’s discuss a few key constraints of Azure durable function.
- You will have have to be very much careful while updating Azure Durable function app code. It might break the normal behavior of the Azure Durable function.
- It’s difficult to generate guids or random numbers.
- Difficult to implement Thread.Sleep.
- You can not call the not deterministic APIs from the Azure Durable Functions. The API must be deterministic. meaning the API always returns the same value by providing the same input irrespective of when or how frequently it is getting called.
You can check out a complete guide on durable functions limitations now.
Azure Durable Functions Pricing
The price of Azure Durable functions is same as Azure Function Pricing.
You may also like following the below articles
- Call Azure Function From SharePoint Framework
- What is Azure Active Directory B2B collaboration (Azure AD B2B)
- How to Create And Consume Azure Function From ASP.NET Core
- How To Call A Stored Procedure From Azure Functions
Wrapping Up
Well, In this article, we discussed What Are Azure Durable Functions, Why Durable Functions, Supported Languages for Durable Functions, Key Benefits of Durable Functions, and we also discussed Different Patterns Of Durable Functions, When To Use Durable Functions, How To Create Durable Functions Using Visual Studio 2019, How to Enable Durable Functions, Azure Functions VS Durable Functions, Durable Functions VS Logic Apps, Azure Durable Functions VS AWS Step Functions, Durable Functions Limitations, Azure Durable Functions Pricing. Hope you have enjoyed this article !!!