Skip to main content
net8.0

Azure Functions resource types for Aspire.

Published
Oct 24, 2026
9d ago
Total Downloads
2.3M
2,340,458

Install

dotnet add package Aspire.Hosting.Azure.Functions --version 13.6.4
ProductVersions
.NET
net8.0

README

Azure Functions hosting integration

Use this integration to model, configure, and orchestrate Azure Functions projects in an Aspire solution.

Getting started

Prerequisites

  • An Aspire project based on the starter template.
  • An Azure Functions app project.

Add the integration

From your AppHost directory, add the Aspire.Hosting.Azure.Functions integration with the Aspire CLI:

aspire add Aspire.Hosting.Azure.Functions

Usage example

In the AppHost, use AddAzureFunctionsProject to configure the Functions app resource. C# AppHosts use the generated project metadata type; TypeScript AppHosts point at the Functions app directory.

C#

using Aspire.Hosting;
using Aspire.Hosting.Azure;
using Aspire.Hosting.Azure.Functions;

var builder = new DistributedApplicationBuilder();

var storage = builder.AddAzureStorage("storage").RunAsEmulator();
var queue = storage.AddQueues("queue");
var blob = storage.AddBlobs("blob");

builder.AddAzureFunctionsProject<Projects.Company_FunctionApp>("my-functions-project")
    .WithReference(queue)
    .WithReference(blob);

var app = builder.Build();

app.Run();

TypeScript

import { createBuilder } from "./.aspire/modules/aspire.mjs";

const builder = await createBuilder();

const storage = await builder.addAzureStorage("storage").runAsEmulator();
const queue = await storage.addQueues("queue");
const blob = await storage.addBlobs("blob");

await builder.addAzureFunctionsProject("my-functions-project", "../Company.FunctionApp")
    .withReference(queue)
    .withReference(blob);

await builder.build().run();

Durable Task Scheduler (Durable Functions)

The Azure Functions hosting integration also provides resource APIs for using the Durable Task Scheduler (DTS) with Durable Functions.

In the AppHost, add a Scheduler resource, create one or more Task Hubs, and pass the connection string and hub name to your Functions app resource:

using Aspire.Hosting;
using Aspire.Hosting.Azure;
using Aspire.Hosting.Azure.Functions;

var builder = DistributedApplication.CreateBuilder(args);

var storage = builder.AddAzureStorage("storage").RunAsEmulator();

var scheduler = builder.AddDurableTaskScheduler("scheduler")
    .RunAsEmulator();

var taskHub = scheduler.AddTaskHub("taskhub");

builder.AddAzureFunctionsProject<Projects.Company_FunctionApp>("funcapp")
    .WithHostStorage(storage)
    .WithReference(taskHub);

builder.Build().Run();

Use the DTS emulator

RunAsEmulator() starts a local container running the Durable Task Scheduler emulator.

When a Scheduler runs as an emulator, Aspire automatically provides:

  • A "Scheduler Dashboard" URL for the scheduler resource.
  • A "Task Hub Dashboard" URL for each Task Hub resource.
  • A DTS_TASK_HUB_NAMES environment variable on the emulator container listing the Task Hub names associated with that scheduler.

Use an existing Scheduler

If you already have a Scheduler instance, configure the resource using its connection string:

var schedulerConnectionString = builder.AddParameter(
    "dts-connection-string",
    "Endpoint=https://existing-scheduler.durabletask.io;Authentication=DefaultAzure");

var scheduler = builder.AddDurableTaskScheduler("scheduler")
    .RunAsExisting(schedulerConnectionString);

var taskHubName = builder.AddParameter("taskhub-name", "mytaskhub");
var taskHub = scheduler.AddTaskHub("taskhub").WithTaskHubName(taskHubName);

Additional documentation

Feedback & contributing

https://github.com/microsoft/aspire

Changes from Previous Version

No structural changes between v13.6.3 and v13.6.4.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.The published metadata declares 47 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.