Automation
Azure Durable Functions: validate orchestration versioning before redeploying active instances
A production runbook for classifying breaking orchestrator changes, inventorying active instances, canarying version routing and deciding deployment or rollback without breaking replay.
A Durable Functions release adds a fraud-review activity between payment authorization and order confirmation. The deployment is small, tests pass and new instances follow the expected path. Several older instances are still waiting for an external approval event, however. When they wake up, the orchestrator replays history against code whose sequence of durable operations has changed.
Restarting the Function App does not solve that contract mismatch. Purging history destroys the evidence and may abandon business work. A rollback can also fail if new instances have already been created with the new sequence. The release has to preserve deterministic replay for old instances while routing new instances to the intended logic.
This runbook qualifies that change before deployment. It ends with one bounded decision: promote a versioned orchestrator, hold the release until active instances drain, isolate the new workflow, or restore the previous worker and entry point.
Freeze the release and the orchestration population
Stop automatic promotion, but do not terminate or purge running instances. Record the task hub, storage provider, Function App release, Durable extension version, orchestrator name and current entry point. Preserve one known-good history for every meaningful state: running an activity, waiting for an event, waiting on a timer, failed and suspended.
change: CHG-DF-241
window_utc: 2026-11-14T07:00:00Z/2026-11-14T09:00:00Z
runtime:
function_app: orders-workflow-prod
task_hub: OrdersHub
storage_provider: <azure-storage-or-other>
worker_model: <isolated-or-other>
durable_extension: <observed-version>
deployed_release: orders-2026.11.08.4
candidate_release: orders-2026.11.14.1
orchestration:
name: OrderLifecycle
current_default_version: <unset-or-version>
candidate_default_version: "2.0"
active_instances_by_state:
Running: <count>
Pending: <count>
Suspended: <count>
oldest_instance_created_utc: <timestamp>
evidence:
previous_artifact_digest: <digest>
candidate_artifact_digest: <digest>
representative_instance_ids: [<id-running>, <id-event>, <id-timer>]
rollback_owner: <role> Count instances by creation time, runtime status, orchestration name and version when available. Instances created before versioning was enabled can have no version; treat that as a real legacy path, not as version 2.0. Also identify eternal orchestrations and workflows with no predictable drain window.
Classify the code change by replay impact
Review the orchestrator diff separately from activity implementations. An activity can change internally without changing the durable schedule, provided its input, output and side-effect contract remains compatible. Orchestrator changes are more sensitive because replay must schedule the same durable operations in the same logical order as the stored history.
Treat the change as breaking when it can alter history matching, including:
- adding, removing or reordering an activity, sub-orchestration, timer or external event;
- renaming a called function or changing serialized input and output contracts;
- moving a branch before an operation already present in active histories;
- reading mutable configuration, current system time, random values or direct I/O from orchestrator code;
- deleting a legacy branch while instances still carry that version.
Do not label a change safe because the new path works from an empty history. The useful test is whether the candidate code can replay histories captured before the release and reach the same next durable action.
Change: insert FraudReview after AuthorizePayment
Existing history v1
ValidateOrder -> AuthorizePayment -> WaitForApproval -> ConfirmOrder
Candidate history v2
ValidateOrder -> AuthorizePayment -> FraudReview -> WaitForApproval -> ConfirmOrder
Compatibility decision
Existing v1 instances must retain the v1 sequence
New v2 instances may schedule FraudReview
FraudReview must not be inferred as completed for an old history
The starter must make the selected version observable Choose a version boundary that the runtime can enforce
Built-in orchestration versioning assigns a version to each new instance and lets newer workers process compatible older versions. Configure the default deliberately instead of relying on the deployment name. CurrentOrOlder supports a rolling upgrade only when the candidate worker still contains the legacy logic. Strict requires workers for every active version. Disabling matching removes the isolation the release depends on.
{
"version": "2.0",
"extensions": {
"durableTask": {
"hubName": "OrdersHub",
"defaultVersion": "2.0",
"versionMatchStrategy": "CurrentOrOlder"
}
}
} Keep the legacy branch explicit inside the orchestrator. The exact API depends on the supported language worker and Durable extension, but the contract is the same: an instance created as 1.0 continues to produce the v1 durable sequence, while 2.0 enables the new activity.
var version = context.Version;
await context.CallActivityAsync("ValidateOrder", order);
await context.CallActivityAsync("AuthorizePayment", order);
if (version == "2.0")
{
await context.CallActivityAsync("FraudReview", order);
}
await context.WaitForExternalEvent<bool>("ApprovalReceived");
await context.CallActivityAsync("ConfirmOrder", order); Handle an empty version as a documented legacy case when unversioned instances exist. Do not compare arbitrary version strings as if every format had semantic ordering; use one version convention and test the runtime’s matching behavior before relying on it.
Replay representative histories before production
Create a staging task hub isolated from production scheduling. Replay sanitized histories or reconstruct equivalent instances at the same durable boundaries. Cover at least one instance created without a version, each active supported version and every wait type affected by the diff.
The canary must prove both directions:
- the candidate worker resumes an old instance and schedules the same next durable operation;
- an old worker never consumes work belonging to a newer orchestration version;
- a new instance receives the candidate version and follows the new sequence;
- activity retries and external events do not duplicate business side effects;
- logs identify release, instance, execution, orchestration version and next scheduled action.
Compare histories, not only final status. A completed canary can still be wrong if it called FraudReview twice, consumed an approval event under the wrong instance or confirmed an order before the review result was durable.
Canary the worker and the starter separately
Deploy the candidate worker without immediately moving every starter to version 2.0. First allow it to process a bounded set of copied or non-critical v1 instances. Then enable the new default for a controlled starter or tenant and create fresh v2 instances. This separates backward replay compatibility from forward routing.
Define abort conditions before the first instance starts: any nondeterminism error, version mismatch, unexpected durable action, duplicate downstream operation, growing control-queue age or instance that stops progressing across its normal wake-up interval.
let Start = datetime(2026-11-14T07:00:00Z);
let End = datetime(2026-11-14T09:00:00Z);
DurableReleaseEvents
| where TimeGenerated between (Start .. End)
| where ChangeId == "CHG-DF-241"
| summarize
Instances=dcount(InstanceId),
ReplayFailures=countif(EventType == "nondeterminism"),
VersionRejects=countif(EventType == "version_reject"),
UnexpectedActions=countif(ContractResult == "unexpected_action"),
DuplicateEffects=countif(EffectResult == "duplicate"),
P95WakeupDelayMs=percentile(WakeupDelayMs, 95)
by Release, OrchestrationVersion, OrchestratorName
| order by OrchestrationVersion asc DurableReleaseEvents is an example normalized table. Map runtime traces, application telemetry and deployment evidence into this contract; do not assume it is a native Durable Functions table. Suppress replay-duplicate application logs or mark them explicitly, but never suppress the runtime evidence needed to diagnose a replay failure.
Keep rollback compatible with both populations
A binary rollback is safe only while the previous worker can understand every instance it may receive. Once v2 instances exist, sending them to a v1-only worker can strand or reject them. Rollback therefore has two coordinated controls: restore the starter so no new v2 instances are created, and retain a compatible worker for already-created v2 instances.
If the candidate has not created v2 instances, return the starter and worker to the previous release. If v2 instances exist but no side effect has occurred, suspend them and use the approved recovery procedure rather than changing their version in place. If v2 work has produced side effects, preserve histories and reconcile the business state before termination or compensation.
Never purge history as a deployment rollback. Purge is a retention operation after terminal state and evidence requirements are satisfied; it does not make an incompatible orchestration safe.
Decide promotion, hold or rollback
Promote when every active legacy version has a tested code path, the candidate replays representative histories, new instances receive the expected version, queue age remains bounded and positive plus negative canaries pass without duplicate effects.
Hold when the instance inventory is incomplete, unversioned instances have no tested branch, the worker and starter cannot be deployed independently, or the team cannot keep old logic until its last instance reaches a terminal state.
Roll back the starter immediately on a version-routing error. Roll back the worker only for the instance versions it can still process, keep a compatible worker for newer instances, and preserve the failed histories. The closing record must list active counts per version, the last supported legacy version, the canary instance IDs and the owner of legacy-code retirement.
Conclusion
Durable Functions deployment safety is a history-compatibility problem, not only an artifact deployment problem. Active instances replay their stored decisions against the code now available, so a clean startup and successful new instance do not qualify a release.
The production decision is explicit: version the durable sequence and prove both old and new paths, wait for the population to drain, isolate the new workflow, or restore routing while keeping compatible workers alive. That is the boundary between an ordinary release and a rollback that can actually recover running work.