Edit

Share via


Develop with Durable Task Scheduler (preview)

The Durable Task Scheduler is a highly performant, fully managed backend provider for Durable Functions with an out-of-the-box monitoring dashboard. Azure offers two developer-oriented orchestration frameworks that work with Durable Functions to build apps: Durable Task SDKs and Durable Functions.

In this article, you learn to:

  • Run the Durable Task Scheduler emulator
  • Perform CRUD operations on a scheduler and task hub.

Learn more about Durable Task Scheduler features, supported regions, and plans.

Durable Task Scheduler emulator

The Durable Task Scheduler emulator is only available as a Docker image today.

  1. Pull the docker image containing the emulator.

    docker pull mcr.microsoft.com/dts/dts-emulator:latest
    
  2. Run the emulator.

    docker run -itP mcr.microsoft.com/dts/dts-emulator:latest
    

    This command exposes a single task hub named default. If you need more than one task hub, you can set the environment variable DTS_TASK_HUB_NAMES on the container to a comma-delimited list of task hub names like in the following command:

    docker run -itP -e DTS_TASK_HUB_NAMES=taskhub1,taskhub2,taskhub3 mcr.microsoft.com/dts/dts-emulator:latest
    

Prerequisites

Set up the CLI

  1. Log in to the Azure CLI and make sure you have the latest installed.

    az login
    az upgrade
    
  2. Install the Durable Task Scheduler CLI extension.

    az extension add --name durabletask
    
  3. If you already installed the Durable Task Scheduler CLI extension, upgrade to the latest version.

    az extension add --upgrade --name durabletask
    

Create a scheduler and task hub

  1. Create a resource group.

    az group create --name YOUR_RESOURCE_GROUP --location LOCATION
    
  2. Using the durabletask CLI extension, create a scheduler.

    az durabletask scheduler create --name "YOUR_SCHEDULER" --resource-group "YOUR_RESOURCE_GROUP" --location "LOCATION" --ip-allowlist "[0.0.0.0/0]" --sku-name "dedicated" --sku-capacity "1"
    

    The creation process may take up to 15 minutes to complete.

    Output

    {
        "id": "/subscriptions/YOUR_SUBSCRIPTION_ID/resourceGroups/YOUR_RESOURCE_GROUP/providers/Microsoft.DurableTask/schedulers/YOUR_SCHEDULER",
        "location": "northcentralus",
        "name": "YOUR_SCHEDULER",
        "properties": {
            "endpoint": "https://YOUR_SCHEDULER.northcentralus.durabletask.io",
            "ipAllowlist": [
                "0.0.0.0/0"
            ],
            "provisioningState": "Succeeded",
            "sku": {
                "capacity": 1,
                "name": "Dedicated",
                "redundancyState": "None"
            }
        },
        "resourceGroup": "YOUR_RESOURCE_GROUP",
        "systemData": {
            "createdAt": "2025-01-06T21:22:59Z",
            "createdBy": "[email protected]",
            "createdByType": "User",
            "lastModifiedAt": "2025-01-06T21:22:59Z",
            "lastModifiedBy": "[email protected]",
            "lastModifiedByType": "User"
        },
        "tags": {}
    }
    
  3. Create a task hub.

    az durabletask taskhub create --resource-group YOUR_RESOURCE_GROUP --scheduler-name YOUR_SCHEDULER --name YOUR_TASKHUB
    

    Output

    {
      "id": "/subscriptions/YOUR_SUBSCRIPTION_ID/resourceGroups/YOUR_RESOURCE_GROUP/providers/Microsoft.DurableTask/schedulers/YOUR_SCHEDULERS/taskHubs/YOUR_TASKHUB",
      "name": "YOUR_TASKHUB",
      "properties": {
        "provisioningState": "Succeeded"
      },
      "resourceGroup": "YOUR_RESOURCE_GROUP",
      "systemData": {
        "createdAt": "2024-09-18T22:13:56.5467094Z",
        "createdBy": "OBJECT_ID",
        "createdByType": "User",
        "lastModifiedAt": "2024-09-18T22:13:56.5467094Z",
        "lastModifiedBy": "OBJECT_ID",
        "lastModifiedByType": "User"
      },
      "type": "microsoft.durabletask/scheduler/taskhubs"
    }
    
  1. In the Azure portal, search for Durable Task Scheduler and select it from the results.

    Screenshot of searching for the Durable Task Scheduler in the portal.

  2. Click Create to open the Azure Functions: Durable Task Scheduler (preview) pane.

    Screenshot of the create page for the Durable Task Scheduler.

  3. Fill out the fields in the Basics tab. Click Review + create. Once the validation passes, click Create.

    Deployment may take around 15 to 20 minutes.

View all Durable Task Scheduler resources in a subscription

  1. Get a list of all scheduler names within a subscription by running the following command.

    az durabletask scheduler list --subscription <SUBSCRIPTION_ID>
    
  2. You can narrow down results to a specific resource group by adding the --resource-group flag.

    az durabletask scheduler list --subscription <SUBSCRIPTION_ID> --resource-group <RESOURCE_GROUP_NAME>
    

In the Azure portal, search for Durable Task Scheduler and select it from the results.

Screenshot of searching for the Durable Task Scheduler service in the portal.

You can see the list of scheduler resources created in all subscriptions you have access to.

View all task hubs in a Durable Task Scheduler

  1. Retrieve a list of task hubs in a specific scheduler by running:

    az durabletask taskhub list --resource-group <RESOURCE_GROUP_NAME> --scheduler-name <SCHEDULER_NAME>
    

You can see all the task hubs created in a scheduler on the Overview of the resource on Azure portal.

Screenshot of overview tab of Durable Task Scheduler in the portal.

Delete the scheduler and task hub

  1. Delete the scheduler:

    az durabletask scheduler --resource-group YOUR_RESOURCE_GROUP --scheduler-name YOUR_SCHEDULER
    
  2. Delete a task hub:

    az durabletask taskhub delete --resource-group YOUR_RESOURCE_GROUP --scheduler-name YOUR_SCHEDULER --name YOUR_TASKHUB
    
  1. Open the scheduler resource on Azure portal and click Delete:

    Screenshot of scheduler resource in the portal highlighting delete button.

  2. Find the scheduler with the task hub you want to delete, then click into that task hub. Click Delete:

    Screenshot of task hub resource in the portal highlighting delete button.

Configure identity-based authentication for app to access Durable Task Scheduler

Durable Task Scheduler only supports either user-assigned or system-assigned managed identity authentication. User-assigned identities are recommended, as they aren't tied to the lifecycle of the app and can be reused after the app is deprovisioned.

Learn more about identity-based access in Durable Task Scheduler.

Access the Durable Task Scheduler dashboard

Assign the required role to your developer identity (email) to gain access to the Durable Task Scheduler dashboard.

Next steps

For using Durable Task Scheduler with Durable Functions:

For using Durable Task Scheduler with the Durable Task SDKs: