Aspire.Hosting.Azure.Functions
17.0.0
Prefix Reserved
dotnet add package Aspire.Hosting.Azure.Functions --version 17.0.0
NuGet\Install-Package Aspire.Hosting.Azure.Functions -Version 17.0.0
<PackageReference Include="Aspire.Hosting.Azure.Functions" Version="17.0.0" />
<PackageVersion Include="Aspire.Hosting.Azure.Functions" Version="17.0.0" />
<PackageReference Include="Aspire.Hosting.Azure.Functions" />
paket add Aspire.Hosting.Azure.Functions --version 17.0.0
#r "nuget: Aspire.Hosting.Azure.Functions, 17.0.0"
#:package Aspire.Hosting.Azure.Functions@17.0.0
#addin nuget:?package=Aspire.Hosting.Azure.Functions&version=17.0.0
#tool nuget:?package=Aspire.Hosting.Azure.Functions&version=17.0.0
Azure Functions hosting integration
Use this integration to model, configure, and orchestrate Azure Functions apps in an Aspire solution.
Getting started
Prerequisites
- An Aspire project based on the starter template.
- An Azure Functions app. .NET isolated worker apps can be referenced as projects. TypeScript and JavaScript apps can be referenced by directory.
- Azure Functions Core Tools for local JavaScript Functions apps. TypeScript Functions apps normally reference
azure-functions-core-toolsfromdevDependenciesand run it through an npm script.
Add the integration
From your AppHost directory, add the Aspire.Hosting.Azure.Functions integration with the Aspire CLI:
aspire add Aspire.Hosting.Azure.Functions
The .NET Functions resource deliberately retains AddAzureFunctionsProject and its specialized
Functions host/debug behavior. Do not replace it with ordinary AddDotnetProject; that migration
is tracked separately in #21345. Keep its required
generated project metadata and build references. See the project migration guide.
Usage example
In the AppHost, add an Azure Functions app resource and reference Azure resources with either C# or TypeScript.
C# - .NET isolated worker project
using Aspire.Hosting.Azure;
using Aspire.Hosting.Azure.Functions;
var builder = DistributedApplication.CreateBuilder(args);
var storage = builder.AddAzureStorage("storage").RunAsEmulator();
var queue = storage.AddQueues("queue");
var blob = storage.AddBlobs("blob");
builder.AddAzureFunctionsProject<Projects.Company_FunctionApp>("functions")
.WithReference(queue)
.WithReference(blob);
builder.Build().Run();
C# - TypeScript or JavaScript app directory
#pragma warning disable ASPIREAZUREFUNCTIONS001
using Aspire.Hosting.Azure;
using Aspire.Hosting.Azure.Functions;
var builder = DistributedApplication.CreateBuilder(args);
var storage = builder.AddAzureStorage("storage").RunAsEmulator();
var blob = storage.AddBlobs("blob");
builder.AddAzureFunctionsApp("functions", "../functions", AzureFunctionsLanguage.TypeScript)
.WithReference(blob);
builder.Build().Run();
#pragma warning restore ASPIREAZUREFUNCTIONS001
TypeScript
import { AzureFunctionsLanguage, createBuilder } from "./.aspire/modules/aspire.mjs";
const builder = await createBuilder();
const storage = await builder.addAzureStorage("storage").runAsEmulator();
const blob = await storage.addBlobs("blob");
await builder.addAzureFunctionsApp("functions", "../functions", AzureFunctionsLanguage.TypeScript)
.withReference(blob);
await builder.build().run();
TypeScript and JavaScript Functions apps
The directory-based APIs (AddAzureFunctionsApp, AzureFunctionsAppResource, AzureFunctionsLanguage, and the app-specific extension overloads) are experimental pending API review and may change or be removed. C# callers must opt in by suppressing diagnostic ASPIREAZUREFUNCTIONS001, for example with #pragma warning disable ASPIREAZUREFUNCTIONS001. The existing .NET project APIs are unaffected.
Directory-based Functions apps run on the Azure Functions Node worker with FUNCTIONS_WORKER_RUNTIME set to node.
TypeScript apps are started with:
npm run start -- --port <port>
The Functions app should include scripts similar to the standard Azure Functions TypeScript template:
{
"scripts": {
"build": "tsc",
"prestart": "npm run build",
"start": "func start"
},
"devDependencies": {
"azure-functions-core-tools": "^4.0.0",
"typescript": "^5.0.0"
}
}
JavaScript apps are started directly with:
func host start --port <port>
Use WithHostStorage to choose the Azure Storage resource used by the Functions host. If host storage is not specified, Aspire adds an implicit storage resource for the Functions runtime.
Publish and deployment
When a TypeScript or JavaScript Functions app does not include a Dockerfile, Aspire publish generates a Dockerfile that uses the official Azure Functions Node image, copies the app to /home/site/wwwroot, installs npm dependencies, and runs npm run build for TypeScript apps. After the build (or installation for JavaScript), it runs npm prune --omit=dev so the deployed app retains only production dependencies.
If the Functions app directory already contains a Dockerfile, Aspire uses that Dockerfile instead. Use this to select a different Azure Functions Node image, customize the Node version, or add project-specific build steps.
When deployed to Azure Container Apps, Functions resources are published with the container app kind set to functionapp and the Functions container port set to 80.
Debugging
.NET isolated worker Functions projects use the Azure Functions extension integration for debugging.
TypeScript and JavaScript Functions apps use VS Code JavaScript debugging. Aspire does not add a service-discovery endpoint for the Node inspector. During a VS Code debug session, the Aspire extension starts the Functions host with a loopback-only Node inspector port by setting languageWorkers__node__arguments, then attaches the JavaScript debugger to that port.
TypeScript debugging assumes the standard Azure Functions TypeScript output under dist/**/*.js unless an explicit VS Code debugger configuration overrides outFiles.
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.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 "Manage" URL for the scheduler resource.
- A "Task Hub Dashboard" URL for each Task Hub resource.
- A
DTS_TASK_HUB_NAMESenvironment 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
- https://aspire.dev/integrations/gallery/
- https://aspire.dev/integrations/cloud/azure/azure-functions/azure-functions-host/
- https://learn.microsoft.com/azure/azure-functions
- https://learn.microsoft.com/azure/azure-functions/functions-reference-node
- https://learn.microsoft.com/azure/azure-functions/functions-how-to-custom-container
- https://learn.microsoft.com/azure/azure-functions/durable/durable-task-scheduler/durable-task-scheduler
Feedback & contributing
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Aspire.Hosting.Azure (>= 17.0.0)
- Aspire.Hosting.Azure.Storage (>= 17.0.0)
- AspNetCore.HealthChecks.Azure.Storage.Blobs (>= 9.0.0)
- AspNetCore.HealthChecks.Azure.Storage.Queues (>= 9.0.0)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Azure.Core (>= 1.63.0)
- Azure.Identity (>= 1.21.0)
- Azure.Provisioning (>= 1.6.0)
- Azure.Provisioning.KeyVault (>= 1.1.0)
- Azure.Provisioning.Storage (>= 1.2.0)
- Azure.ResourceManager.Authorization (>= 1.1.7)
- Azure.ResourceManager.KeyVault (>= 1.4.0)
- Azure.ResourceManager.Resources.Deployments (>= 1.0.0)
- Azure.Security.KeyVault.Secrets (>= 4.11.1)
- Azure.Storage.Blobs (>= 12.29.2)
- Azure.Storage.Files.DataLake (>= 12.27.1)
- Azure.Storage.Queues (>= 12.27.1)
- Google.Protobuf (>= 3.36.1)
- Grpc.AspNetCore (>= 2.83.0)
- Grpc.Net.ClientFactory (>= 2.83.0)
- Grpc.Tools (>= 2.83.0)
- Hex1b (>= 0.173.0)
- KubernetesClient (>= 19.0.2)
- MessagePack (>= 2.5.307)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.15)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.15)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.15)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.15)
- Microsoft.Extensions.Hosting (>= 10.0.15)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Http (>= 10.0.15)
- Microsoft.Extensions.Logging (>= 10.0.15)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Options (>= 10.0.15)
- Microsoft.Extensions.Primitives (>= 10.0.15)
- ModelContextProtocol (>= 1.4.1)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.18.0)
- OpenTelemetry.Extensions.Hosting (>= 1.18.0)
- Polly.Core (>= 8.7.0)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.25.29)
- System.IO.Hashing (>= 10.0.15)
- YamlDotNet (>= 18.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (4)
Showing the top 4 popular GitHub repositories that depend on Aspire.Hosting.Azure.Functions:
| Repository | Stars |
|---|---|
|
microsoft/aspire-samples
Browse the sample apps demonstrating Aspire integration across C#, JavaScript, TypeScript, Python, Go, containers, databases, cloud, AI, and observability scenarios.
|
|
|
microsoft/AzUrlShortener
A simple and easy Url Shortener
|
|
|
J-Tech-Japan/Sekiban
Sekiban - an Opinionated Event Sourcing and CQRS Framework using C#. It can store data into Azure Cosmos DB, AWS Dynamo DB or Postgres
|
|
|
Azure-Samples/eShopLite
eShopLite is a set of reference .NET applications implementing an eCommerce site with features like Semantic Search, MCP, Reasoning models and more.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 17.0.0 | 0 | 11/18/2026 |
| 13.6.5 | 45,359 | 11/10/2026 |
| 13.6.4 | 72,432 | 10/24/2026 |
| 13.6.3 | 15,953 | 10/21/2026 |
| 13.6.2 | 10,653 | 10/20/2026 |
| 13.6.1 | 70,301 | 10/7/2026 |
| 13.6.0 | 45,298 | 9/29/2026 |
| 13.5.4 | 72,177 | 9/15/2026 |
| 13.5.3 | 123,886 | 8/25/2026 |
| 13.5.2 | 39,944 | 8/21/2026 |
| 13.5.1 | 12,343 | 8/20/2026 |
| 13.5.0 | 14,902 | 8/18/2026 |
| 13.4.6 | 367,937 | 6/19/2026 |
| 13.4.5 | 31,216 | 6/17/2026 |
| 13.4.4 | 15,564 | 6/15/2026 |
| 13.4.3 | 56,289 | 6/8/2026 |
| 13.4.2 | 23,962 | 6/3/2026 |
| 13.4.1 | 1,592 | 6/3/2026 |
| 13.4.0 | 11,180 | 6/1/2026 |
| 13.3.5 | 78,272 | 5/21/2026 |