Aspire.Hosting.Azure.AppService
13.0.0-preview.1.25560.3
Prefix Reserved
dotnet add package Aspire.Hosting.Azure.AppService --version 13.0.0-preview.1.25560.3
NuGet\Install-Package Aspire.Hosting.Azure.AppService -Version 13.0.0-preview.1.25560.3
<PackageReference Include="Aspire.Hosting.Azure.AppService" Version="13.0.0-preview.1.25560.3" />
<PackageVersion Include="Aspire.Hosting.Azure.AppService" Version="13.0.0-preview.1.25560.3" />
<PackageReference Include="Aspire.Hosting.Azure.AppService" />
paket add Aspire.Hosting.Azure.AppService --version 13.0.0-preview.1.25560.3
#r "nuget: Aspire.Hosting.Azure.AppService, 13.0.0-preview.1.25560.3"
#:package Aspire.Hosting.Azure.AppService@13.0.0-preview.1.25560.3
#addin nuget:?package=Aspire.Hosting.Azure.AppService&version=13.0.0-preview.1.25560.3&prerelease
#tool nuget:?package=Aspire.Hosting.Azure.AppService&version=13.0.0-preview.1.25560.3&prerelease
Aspire.Hosting.Azure.AppService library
Provides extension methods and resource definitions for an Aspire AppHost to configure Azure App Service for the compute resources (like project).
Getting started
Prerequisites
- Azure subscription (requires Owner access to the target subscription for role assignments)
Install the package
In your AppHost project, install the Aspire Azure App Service Hosting library with NuGet:
dotnet add package Aspire.Hosting.Azure.AppService
Usage example
Then, in the AppHost.cs file of AppHost, add an Azure App Service Environment and publish your project as an Azure App Service Web App:
var builder = DistributedApplication.CreateBuilder(args);
var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env");
builder.AddProject<Projects.MyWebApp>("webapp")
.WithExternalHttpEndpoints()
.PublishAsAzureAppServiceWebsite((infrastructure, website) =>
{
// Customize the App Service health check path and appsettings
website.SiteConfig.HealthCheckPath = "/health";
website.SiteConfig.AppSettings.Add(new AppServiceNameValuePair()
{
Name = "Environment",
Value = "Production"
});
});
Azure App Service constraints
When deploying to Azure App Service, the following constraints apply:
- External endpoints only: App Service only supports external endpoints. All endpoints must be configured using
WithExternalHttpEndpoints(). - HTTP/HTTPS only: Only HTTP and HTTPS endpoints are supported. Other protocols are not supported.
- Single endpoint: App Service supports only a single target port. Resources with multiple external endpoints with different target ports are not supported. The default target port is 8000, which can be overridden using the
WithHttpEndpointextension method.
Publishing compute resources to Azure App Service
The PublishAsAzureAppServiceWebsite extension method is used to configure a compute resource (such as a project) to be published as an Azure App Service Web App when deploying to Azure. This method allows you to customize the App Service Web App configuration using the Azure Provisioning SDK.
builder.AddProject<Projects.MyApi>("api")
.WithHttpEndpoint(targetPort: 8080)
.WithExternalHttpEndpoints()
.WithHealthProbe(ProbeType.Liveness, "/health")
.WithArgs("--environment", "Production")
.PublishAsAzureAppServiceWebsite((infrastructure, website) =>
{
// Customize the App Service Web App appsettings
website.SiteConfig.IsWebSocketsEnabled = true;
website.SiteConfig.MinTlsVersion = SupportedTlsVersions.Tls1_2;
});
Adding an Azure App Service Environment
The Azure App Service Environment resource creates the underlying infrastructure needed to host your applications, including:
- An Azure App Service Plan (default SKU: P0v3)
- An Azure Container Registry for storing container images
- A managed identity for accessing the container registry
- Optionally, the Aspire Dashboard as an Azure App Service Web App
- Optionally, Application Insights for monitoring and telemetry
var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env");
By default, the Aspire Dashboard is included in the App Service Environment. To disable the dashboard, use the WithDashboard extension method:
var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env")
.WithDashboard(enable: false);
Enabling Application Insights
Application Insights can be enabled for the App Service Environment using the WithAzureApplicationInsights extension method. A different location can be specified for Application Insights using the optional location parameter:
var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env")
.WithAzureApplicationInsights();
Customizing the App Service Plan
The App Service Plan can be customized using the ConfigureInfrastructure extension method.
The default SKU for the App Service Plan is P0V3 and can be changed using this extension method:
var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env")
.ConfigureInfrastructure((infra) =>
{
var plan = infra.GetProvisionableResources().OfType<AppServicePlan>().Single();
plan.Sku = new AppServiceSkuDescription
{
Name = "P2V3",
Tier = "Premium"
};
});
Additional documentation
Feedback & contributing
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- Aspire.Hosting.Azure (>= 13.0.0)
- Aspire.Hosting.Azure.ApplicationInsights (>= 13.0.0)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Azure.Core (>= 1.49.0)
- Azure.Identity (>= 1.17.0)
- Azure.Provisioning (>= 1.3.0)
- Azure.Provisioning.ApplicationInsights (>= 1.1.0)
- Azure.Provisioning.AppService (>= 1.2.0)
- Azure.Provisioning.ContainerRegistry (>= 1.1.0)
- Azure.Provisioning.KeyVault (>= 1.1.0)
- Azure.Provisioning.OperationalInsights (>= 1.1.0)
- Azure.ResourceManager.Authorization (>= 1.1.6)
- Azure.ResourceManager.KeyVault (>= 1.3.3)
- Azure.ResourceManager.Resources (>= 1.11.1)
- Azure.Security.KeyVault.Secrets (>= 4.8.0)
- Google.Protobuf (>= 3.33.0)
- Grpc.AspNetCore (>= 2.71.0)
- Grpc.Net.ClientFactory (>= 2.71.0)
- Grpc.Tools (>= 2.72.0)
- Humanizer.Core (>= 2.14.1)
- JsonPatch.Net (>= 3.3.0)
- KubernetesClient (>= 18.0.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.22)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Primitives (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.4)
- Polly.Core (>= 8.6.4)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.22.23)
- System.IO.Hashing (>= 9.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Aspire.Hosting.Azure.AppService:
| Repository | Stars |
|---|---|
|
SSWConsulting/SSW.CleanArchitecture
SSW Clean Architecture Template
|
|
|
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 |
|---|---|---|
| 13.0.0-preview.1.25560.3 | 0 | 11/11/2025 |
| 9.5.2-preview.1.25522.3 | 230 | 10/23/2025 |
| 9.5.1-preview.1.25502.11 | 413 | 10/3/2025 |
| 9.5.0-preview.1.25474.7 | 628 | 9/25/2025 |
| 9.4.2-preview.1.25428.12 | 353 | 9/2/2025 |
| 9.4.1-preview.1.25408.4 | 946 | 8/12/2025 |
| 9.4.0-preview.1.25378.8 | 876 | 7/29/2025 |
| 9.3.1-preview.1.25305.6 | 2,153 | 6/10/2025 |
| 9.3.0-preview.1.25265.20 | 405 | 5/19/2025 |