Aspire.Hosting.Azure.AppService 13.5.3

Prefix Reserved
dotnet add package Aspire.Hosting.Azure.AppService --version 13.5.3
                    
NuGet\Install-Package Aspire.Hosting.Azure.AppService -Version 13.5.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aspire.Hosting.Azure.AppService" Version="13.5.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aspire.Hosting.Azure.AppService" Version="13.5.3" />
                    
Directory.Packages.props
<PackageReference Include="Aspire.Hosting.Azure.AppService" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aspire.Hosting.Azure.AppService --version 13.5.3
                    
#r "nuget: Aspire.Hosting.Azure.AppService, 13.5.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Aspire.Hosting.Azure.AppService@13.5.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Aspire.Hosting.Azure.AppService&version=13.5.3
                    
Install as a Cake Addin
#tool nuget:?package=Aspire.Hosting.Azure.AppService&version=13.5.3
                    
Install as a Cake Tool

Azure App Service hosting integration

Use this integration to model, configure, and orchestrate Azure App Service for compute resources in an Aspire solution.

Getting started

Prerequisites

  • Azure subscription (requires Owner access to the target subscription for role assignments)

Add the integration

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

aspire add Aspire.Hosting.Azure.AppService

Usage example

In the AppHost, add an Azure App Service Environment and publish a compute resource 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 WithHttpEndpoint extension method.

Publishing compute resources to Azure App Service

The PublishAsAzureAppServiceWebsite extension method configures a compute resource 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.Api>("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);

Configuring regional virtual network integration

To configure regional virtual network integration for the websites in an Azure App Service environment, add the Aspire.Hosting.Azure.Network integration:

aspire add Aspire.Hosting.Azure.Network

Then create a subnet and apply it to the environment:

#pragma warning disable ASPIREAZURE003 // Azure Virtual Network APIs are experimental.
var vnet = builder.AddAzureVirtualNetwork("vnet");
var subnet = vnet.AddSubnet("app-service-subnet", "10.0.0.0/24");

var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env")
    .WithDelegatedSubnet(subnet);
#pragma warning restore ASPIREAZURE003

TypeScript

const vnet = await builder.addAzureVirtualNetwork("vnet");
const subnet = await vnet.addSubnet("app-service-subnet", "10.0.0.0/24");

const appServiceEnvironment = await builder.addAzureAppServiceEnvironment("env")
    .withDelegatedSubnet(subnet);

WithDelegatedSubnet delegates the subnet to Microsoft.Web/serverFarms and configures every generated website, deployment slot, and the default Aspire Dashboard to use it for regional virtual network integration. The subnet must meet the Azure App Service regional virtual network integration requirements.

Regional virtual network integration affects outbound traffic only. It does not make website or dashboard ingress private, and it does not enable Route All. Configure private endpoints or access restrictions and Route All separately when those behaviors are required.

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

https://github.com/microsoft/aspire

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Aspire.Hosting.Azure.AppService:

Package Downloads
CoconutSharp.Aspire.Hosting

Opinionated application and deployment layer on top of .NET Aspire. Run locally with Aspire, publish with CoconutSharp.

GitHub repositories (4)

Showing the top 4 popular GitHub repositories that depend on Aspire.Hosting.Azure.AppService:

Repository Stars
SSWConsulting/SSW.VerticalSliceArchitecture
An enterprise ready solution template for Vertical Slice Architecture. This template is just one way to apply the Vertical Slice Architecture.
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.
PacktPublishing/Pragmatic-Microservices-with-CSharp-and-Azure
Pragmatic Microservices with C# and Azure, published by Packt
Version Downloads Last Updated
13.5.3 415 8/25/2026
13.5.2 799 8/21/2026
13.5.1 474 8/20/2026
13.5.0 612 8/18/2026
13.4.6 13,364 6/19/2026
13.4.5 2,130 6/17/2026
13.4.4 1,116 6/15/2026
13.4.3 2,787 6/8/2026
13.4.2 6,601 6/3/2026
13.4.1 200 6/3/2026
13.4.0 1,006 6/1/2026
13.3.5 3,746 5/21/2026
13.3.4 700 5/19/2026
13.3.3 886 5/15/2026
13.3.2 807 5/14/2026
13.3.1 1,112 5/12/2026
13.3.0 2,119 5/7/2026
13.2.4 3,207 4/24/2026
13.2.3 873 4/21/2026
13.2.2 3,577 4/8/2026
Loading failed