Uredi

Develop with Durable Task Scheduler

The Durable Task Scheduler is a highly performant, fully managed backend provider for Durable Task with an out-of-the-box monitoring dashboard. Azure offers two developer-oriented orchestration frameworks that work with Durable Task Scheduler 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. Sign in to Azure and ensure you have the latest CLI version.

    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 update --name durabletask
    
  4. Check your installed version:

    az extension show --name durabletask
    

Learn more about the az durabletask commands.

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": "YOUR_EMAIL@example.com",
            "createdByType": "User",
            "lastModifiedAt": "2025-01-06T21:22:59Z",
            "lastModifiedBy": "YOUR_EMAIL@example.com",
            "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. Select Create to open the Durable Task Scheduler pane.

    Screenshot of the create page for the Durable Task Scheduler.

  3. Fill out the fields in the Basics tab. Select Review + create.

  4. Once the validation passes, select 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

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 a scheduler and task hub

  1. Delete the task hub first:

    az durabletask taskhub delete --resource-group YOUR_RESOURCE_GROUP --scheduler-name YOUR_SCHEDULER --name YOUR_TASKHUB
    
  2. Delete the scheduler:

    az durabletask scheduler delete --resource-group YOUR_RESOURCE_GROUP --scheduler-name YOUR_SCHEDULER
    
  1. Open the scheduler resource in the Azure portal and select Delete:

    Screenshot of scheduler resource in the portal highlighting delete button.

  2. Find the scheduler with the task hub you want to delete, then select that task hub. Select Delete:

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

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

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

To grant your app access, assign the Durable Task Data Contributor role to the managed identity. For full setup steps, see Configure identity-based access in Durable Task Scheduler.

Access the Durable Task Scheduler dashboard

To access the Durable Task Scheduler dashboard, assign the Durable Task Dashboard Viewer role to your developer identity. For details, see Durable Task Scheduler dashboard.