You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/dotnet-aspire-integration.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,16 +18,16 @@ ms.date: 04/21/2025
18
18
Set up your development environment for using Azure Functions with .NET Aspire:
19
19
20
20
- Install the [.NET 9 SDK](https://dotnet.microsoft.com/download/dotnet/9.0) and [.NET Aspire 9.0 or later](/dotnet/aspire/fundamentals/setup-tooling). Although the .NET 9 SDK is required, .NET Aspire 9.0 supports the .NET 8 and .NET 9 frameworks.
21
-
- If you use Visual Studio, update to version 17.12 or later. You must also have the latest version of the Functions tools for Visual Studio. To check for updates:
21
+
- If you use Visual Studio, update to version 17.12 or later. You must also have the latest version of the Azure Functions tools for Visual Studio. To check for updates:
22
22
1. Go to **Tools** > **Options**.
23
23
1. Under **Projects and Solutions**, select **Azure Functions**.
24
24
1. Select **Check for updates** and install updates as prompted.
25
25
26
26
## Solution structure
27
27
28
-
A solution that uses Azure Functions and .NET Aspire has multiple projects, including an [app host project](/dotnet/aspire/fundamentals/app-host-overview) and one or more Azure Functions projects.
28
+
A solution that uses Azure Functions and .NET Aspire has multiple projects, including an [app host project](/dotnet/aspire/fundamentals/app-host-overview) and one or more Functions projects.
29
29
30
-
The app host project is the entry point for your application. It orchestrates the setup of the components of your application, including the Azure Functions project.
30
+
The app host project is the entry point for your application. It orchestrates the setup of the components of your application, including the Functions project.
31
31
32
32
The solution typically also includes a *service defaults* project. This project provides a set of default services and configurations to be used across projects in your application.
33
33
@@ -36,7 +36,7 @@ The solution typically also includes a *service defaults* project. This project
36
36
To successfully configure the integration, make sure that the app host project meets the following requirements:
37
37
38
38
- The app host project must reference [Aspire.Hosting.Azure.Functions]. This package defines the necessary logic for the integration.
39
-
- The app host project needs to have a project reference for each Azure Functions project that you want to include in the orchestration.
39
+
- The app host project needs to have a project reference for each Functions project that you want to include in the orchestration.
40
40
- In the app host's `Program.cs` file, you must include the project by calling `AddAzureFunctionsProject<TProject>()` on your `IDistributedApplicationBuilder` instance. You use this method instead of using the `AddProject<TProject>()` method that you use for other project types in .NET Aspire. If you use `AddProject<TProject>()`, the Functions project can't start properly.
41
41
42
42
The following example shows a minimal `Program.cs` file for an app host project:
@@ -53,14 +53,14 @@ builder.Build().Run();
53
53
54
54
To successfully configure the integration, make sure that the Azure Functions project meets the following requirements:
55
55
56
-
- The Azure Functions project must reference the [2.x versions](./dotnet-isolated-process-guide.md#version-2x) of [Microsoft.Azure.Functions.Worker] and [Microsoft.Azure.Functions.Worker.Sdk]. You must also update any [Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore] references to the 2.x version.
56
+
- The Functions project must reference the [2.x versions](./dotnet-isolated-process-guide.md#version-2x) of [Microsoft.Azure.Functions.Worker] and [Microsoft.Azure.Functions.Worker.Sdk]. You must also update any [Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore] references to the 2.x version.
57
57
- Your `Program.cs` file must use the `IHostApplicationBuilder` version of the [host instance startup](./dotnet-isolated-process-guide.md#start-up-and-configuration). This requirement means that you must use `FunctionsApplication.CreateBuilder(args)`.
58
58
- If your solution includes a service defaults project, ensure that your Functions project is configured to use it:
59
59
60
-
- The Azure Functions project should include a project reference to the service defaults project.
60
+
- The Functions project should include a project reference to the service defaults project.
61
61
- Before you build `IHostApplicationBuilder` in `Program.cs`, include a call to `builder.AddServiceDefaults()`.
62
62
63
-
The following example shows a minimal `Program.cs` file for an Azure Functions project used in .NET Aspire:
63
+
The following example shows a minimal `Program.cs` file for a Functions project used in .NET Aspire:
64
64
65
65
```csharp
66
66
usingMicrosoft.Azure.Functions.Worker.Builder;
@@ -79,8 +79,8 @@ This example doesn't include the default Application Insights configuration that
79
79
80
80
To get the most out of the integration, consider the following guidelines:
81
81
82
-
- Don't include any direct Application Insights integrations in the Azure Functions project. Monitoring in .NET Aspire is instead handled through its OpenTelemetry support. You can configure .NET Aspire to export data to Azure Monitor through the service defaults project.
83
-
- Make sure that the Azure Functions project doesn't keep custom configuration in `local.settings.json`. The only setting that you need in `local.settings.json` is `FUNCTIONS_WORKER_RUNTIME`, which should be set to `dotnet-isolated`. Set all other configuration through the app host project.
82
+
- Don't include any direct Application Insights integrations in the Functions project. Monitoring in .NET Aspire is instead handled through its OpenTelemetry support. You can configure .NET Aspire to export data to Azure Monitor through the service defaults project.
83
+
- Make sure that the Functions project doesn't keep custom configuration in `local.settings.json`. The only setting that you need in `local.settings.json` is `FUNCTIONS_WORKER_RUNTIME`, which should be set to `dotnet-isolated`. Set all other configuration through the app host project.
84
84
85
85
## <aname = "connection-configuration-with-aspire"></a>Connection configuration with .NET Aspire
86
86
@@ -120,7 +120,7 @@ builder.Build().Run();
120
120
```
121
121
122
122
> [!NOTE]
123
-
> [Storage Blob Data Owner] is the role that we recommend for the [basic needs for the host storage connection][host-storage-identity]. Your app might encounter problems if the connection to the blob service has only the .NET Aspire default of [Storage Blob Data Contributor].
123
+
> [Storage Blob Data Owner] is the role that we recommend for the [basic needs of the host storage connection][host-storage-identity]. Your app might encounter problems if the connection to the blob service has only the .NET Aspire default of [Storage Blob Data Contributor].
124
124
>
125
125
> For production scenarios, include calls to both `WithHostStorage()` and `WithRoleAssignments()`. You can then set this role explicitly, along with any others that you need.
0 commit comments