Azure Durable Functions is an extension of Azure Functions that lets developers write stateful workflows in ordinary code on a serverless platform. It adds orchestrations, durable entities and reliable timers to the otherwise stateless function as a service model, so a process that runs for seconds, days or months can survive restarts, scale out and resume exactly where it stopped.
In serverless computing, functions are short-lived and forget everything between invocations. Durable Functions solves that limitation by persisting execution history to a storage backend and rebuilding state through replay, which gives teams workflow orchestration without operating a separate workflow engine or paying for idle servers.
How Durable Functions keeps state through event sourcing
Durable Functions works by recording every step of an orchestration as an event in an append-only history and replaying that history to reconstruct local variables whenever the orchestrator wakes up. The underlying engine is the open-source Durable Task Framework, which Microsoft also uses in other products.
When an orchestrator calls an activity, the framework schedules a message, writes a checkpoint and unloads the orchestrator from memory. When the activity completes, the orchestrator runs again from the beginning; calls that already have results in the history return those results immediately instead of executing again. Execution continues past the last recorded point, and the process repeats.
The function types below divide the work between coordination and execution.
| Function type | Role | Key constraint |
|---|---|---|
| Client function | Starts, queries, signals or terminates instances | Any trigger, such as HTTP or a queue |
| Orchestrator function | Defines the workflow and calls other functions | Must be deterministic |
| Activity function | Performs the actual work, such as I/O or computation | Executed at least once |
| Entity function | Holds small pieces of state addressed by an ID | Operations processed one at a time |
Replay explains the most important rule: orchestrator code must be deterministic. Reading the system clock, generating random GUIDs or calling a network service directly would produce different values on each replay, so the API offers safe replacements such as the current orchestration time and a deterministic new GUID.
Application patterns supported by Durable Functions
Durable Functions expresses common distributed workflow patterns in a few lines of code rather than queues, tables and polling logic assembled by hand. The table lists the patterns Microsoft documents and where each fits.
| Pattern | What it does | Typical scenario |
|---|---|---|
| Function chaining | Runs activities in a fixed sequence | Validate, transform and store a document |
| Fan-out/fan-in | Runs activities in parallel, then aggregates | Process thousands of files and sum results |
| Async HTTP API | Returns a status endpoint for long work | Report generation behind a web request |
| Monitor | Polls a condition with durable timers | Wait until an external job finishes |
| Human interaction | Waits for an external event with a timeout | Manager approval within 72 hours |
| Aggregator | Collects events into a stateful entity | Running totals for a device or account |
Durable timers deserve emphasis because they make long waits cheap. An orchestration that waits three days for approval consumes no compute while sleeping on the Consumption or Flex Consumption plan; the framework schedules a message that wakes the instance when the timer fires or the event arrives.
Sub-orchestrations, retry policies with exponential backoff, and the eternal orchestration pattern, which restarts itself with fresh history through a continue-as-new call, extend these basics for larger or indefinitely running processes.
Durable Functions compared with other workflow options
Durable Functions belongs to the code-first workflow category, as opposed to designer-based or JSON-defined state machines. The comparison below shows how it relates to nearby services in serverless architecture.
| Option | Definition style | Strength | Weakness |
|---|---|---|---|
| Azure Durable Functions | Code in C#, JavaScript, Python, Java or PowerShell | Full language power, unit testable | Determinism rules, replay overhead |
| Azure Logic Apps | Visual designer and JSON | Hundreds of ready connectors | Complex logic becomes hard to read |
| AWS Step Functions | Amazon States Language in JSON | Visual execution history | Logic lives outside application code |
| Plain queues and functions | Custom code and messages | Maximum control | State and retries built by hand |
Teams with strong developers and complex branching logic usually prefer Durable Functions, while integration-heavy processes maintained by less technical staff often suit Logic Apps better. The two can also be combined, with Logic Apps calling an orchestration through its HTTP management API.
Storage providers, hosting and performance
The storage provider determines throughput, cost and operational behavior. The default provider uses Azure Storage queues, tables and blobs, while alternatives target higher scale or different infrastructure.
| Backend | Underlying store | Best fit |
|---|---|---|
| Azure Storage | Queues, tables and blobs | Default choice, low cost, moderate throughput |
| Netherite | Event Hubs and page blobs | Very high orchestration throughput |
| Microsoft SQL | SQL Server or Azure SQL Database | Portability, on-premises and Kubernetes hosting |
| Durable Task Scheduler | Managed backend service | Built-in monitoring dashboard and higher performance |
Performance depends heavily on history size. Each replay reads the full history, so orchestrations with thousands of steps slow down; splitting work into sub-orchestrations or using continue-as-new keeps histories short. Large inputs and outputs should be stored externally and passed as references, because payloads above provider limits are written to blobs and add latency.
Common mistakes and limitations
Most production incidents with Durable Functions trace back to a small set of design errors, usually related to replay or versioning.
- Non-deterministic orchestrator code, such as direct HTTP calls or reading the clock, causes replay failures and nondeterminism errors.
- Changing orchestration code while instances are in flight can break their replay; versioning strategies or side-by-side deployment are required.
- Non-idempotent activities may run twice after a crash, because activities have at-least-once execution guarantees.
- Unbounded fan-out can overwhelm downstream databases; throttling parallel activity batches protects them.
- Forgetting to purge history lets storage tables grow indefinitely and raises costs over time.
Orchestrations are also not suited to low-latency request paths: each step involves storage writes and queue messages, adding tens to hundreds of milliseconds, so a simple synchronous API call should remain an ordinary function.
The simple explanation
Normal cloud functions are like workers with no memory: they do one small job and forget everything. Azure Durable Functions gives those workers a shared notebook. Every finished step is written down, so if the work is interrupted, a worker can read the notebook and continue from the exact point where it stopped.
This makes it possible to run long processes, such as waiting days for a manager to approve an invoice, without keeping a computer busy the whole time. The key idea is reliable, step-by-step work that remembers its progress, written in normal program code.
How it is used in practice
An insurance company processes claim documents uploaded by customers. A client function starts an orchestration when a file arrives. The orchestrator first runs an activity that extracts text, then fans out to 20 parallel activities that check policy rules, fraud indicators and payment limits, and finally aggregates the results into a single decision.
Claims above a set amount require a human adjuster, so the orchestrator waits up to five days for an approval event, with a durable timer that escalates the case if nobody responds. During that wait no compute is billed. The result is an auditable claims pipeline that handles thousands of claims per day, survives restarts and deployments, and keeps the entire workflow readable in one code file.