From 004c5055183e5a3aed3a6606da658bb3c0a7f4ff Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Oct 2025 00:14:57 +0000 Subject: [PATCH 1/5] Initial plan From 9163770aca1136db693576ce297da54d95a6efbb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Oct 2025 00:22:47 +0000 Subject: [PATCH 2/5] Add README to Aspire.Hosting.Azure.AppService Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> --- src/Aspire.Hosting.Azure.AppService/README.md | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/Aspire.Hosting.Azure.AppService/README.md diff --git a/src/Aspire.Hosting.Azure.AppService/README.md b/src/Aspire.Hosting.Azure.AppService/README.md new file mode 100644 index 00000000000..35e00500a68 --- /dev/null +++ b/src/Aspire.Hosting.Azure.AppService/README.md @@ -0,0 +1,98 @@ +# Aspire.Hosting.Azure.AppService library + +Provides extension methods and resource definitions for a .NET Aspire AppHost to configure Azure App Service. + +## Getting started + +### Prerequisites + +- Azure subscription - [create one for free](https://azure.microsoft.com/free/) + +### Install the package + +Install the .NET Aspire Azure App Service Hosting library with [NuGet](https://www.nuget.org): + +```dotnetcli +dotnet add package Aspire.Hosting.Azure.AppService +``` + +## Configure Azure Provisioning for local development + +Adding Azure resources to the .NET Aspire application model will automatically enable development-time provisioning +for Azure resources so that you don't need to configure them manually. Provisioning requires a number of settings +to be available via .NET configuration. Set these values in user secrets in order to allow resources to be configured +automatically. + +```json +{ + "Azure": { + "SubscriptionId": "", + "ResourceGroupPrefix": "", + "Location": "" + } +} +``` + +> NOTE: Developers must have Owner access to the target subscription so that role assignments +> can be configured for the provisioned resources. + +## Usage example + +In the _Program.cs_ file of your AppHost project, add an Azure App Service Environment and publish your project as an Azure App Service website: + +```csharp +var builder = DistributedApplication.CreateBuilder(args); + +var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env"); + +builder.AddProject("webapp") + .PublishAsAzureAppServiceWebsite((infrastructure, site) => + { + // Configure the App Service website + site.SiteConfig.IsWebSocketsEnabled = true; + }); +``` + +### 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 website when deploying to Azure. This method allows you to customize the App Service website configuration using the Azure Provisioning SDK. + +```csharp +builder.AddProject("api") + .WithHttpEndpoint() + .PublishAsAzureAppServiceWebsite((infrastructure, site) => + { + // Customize the App Service website settings + site.SiteConfig.IsWebSocketsEnabled = true; + site.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 +- 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 website + +```csharp +var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env"); +``` + +By default, the Aspire Dashboard is included in the App Service Environment. To disable the dashboard: + +```csharp +var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env"); +appServiceEnvironment.Resource.EnableDashboard = false; +``` + +## Additional documentation + +* https://learn.microsoft.com/azure/app-service/ +* https://github.com/dotnet/aspire/tree/main/src/Components/README.md + +## Feedback & contributing + +https://github.com/dotnet/aspire From 051db48cf9371f87b15ab873a95d71599cbc5f9a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Oct 2025 10:11:41 +0000 Subject: [PATCH 3/5] Update README to match conventions used in other Azure hosting packages Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com> --- src/Aspire.Hosting.Azure.AppService/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Aspire.Hosting.Azure.AppService/README.md b/src/Aspire.Hosting.Azure.AppService/README.md index 35e00500a68..782fcc1be88 100644 --- a/src/Aspire.Hosting.Azure.AppService/README.md +++ b/src/Aspire.Hosting.Azure.AppService/README.md @@ -10,7 +10,7 @@ Provides extension methods and resource definitions for a .NET Aspire AppHost to ### Install the package -Install the .NET Aspire Azure App Service Hosting library with [NuGet](https://www.nuget.org): +In your AppHost project, install the .NET Aspire Azure App Service Hosting library with [NuGet](https://www.nuget.org): ```dotnetcli dotnet add package Aspire.Hosting.Azure.AppService @@ -38,7 +38,7 @@ automatically. ## Usage example -In the _Program.cs_ file of your AppHost project, add an Azure App Service Environment and publish your project as an Azure App Service website: +In the _AppHost.cs_ file of `AppHost`, add an Azure App Service Environment and publish your project as an Azure App Service website: ```csharp var builder = DistributedApplication.CreateBuilder(args); From 9f3fda112be288752f32ba2610d0e3897e661395 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 18 Oct 2025 05:29:00 +0000 Subject: [PATCH 4/5] Document Azure App Service constraints in README Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> --- src/Aspire.Hosting.Azure.AppService/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Aspire.Hosting.Azure.AppService/README.md b/src/Aspire.Hosting.Azure.AppService/README.md index 782fcc1be88..e753de99a42 100644 --- a/src/Aspire.Hosting.Azure.AppService/README.md +++ b/src/Aspire.Hosting.Azure.AppService/README.md @@ -46,6 +46,7 @@ var builder = DistributedApplication.CreateBuilder(args); var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env"); builder.AddProject("webapp") + .WithExternalHttpEndpoints() .PublishAsAzureAppServiceWebsite((infrastructure, site) => { // Configure the App Service website @@ -53,6 +54,14 @@ builder.AddProject("webapp") }); ``` +## 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. + ### 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 website when deploying to Azure. This method allows you to customize the App Service website configuration using the Azure Provisioning SDK. @@ -60,6 +69,7 @@ The `PublishAsAzureAppServiceWebsite` extension method is used to configure a co ```csharp builder.AddProject("api") .WithHttpEndpoint() + .WithExternalHttpEndpoints() .PublishAsAzureAppServiceWebsite((infrastructure, site) => { // Customize the App Service website settings From 760ba2b973df2eeb1cb35b16215e40fe6aa7f888 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 18 Oct 2025 05:44:16 +0000 Subject: [PATCH 5/5] Remove Azure Provisioning section and use WithDashboard extension method Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> --- src/Aspire.Hosting.Azure.AppService/README.md | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/src/Aspire.Hosting.Azure.AppService/README.md b/src/Aspire.Hosting.Azure.AppService/README.md index e753de99a42..9557ad3ace6 100644 --- a/src/Aspire.Hosting.Azure.AppService/README.md +++ b/src/Aspire.Hosting.Azure.AppService/README.md @@ -16,26 +16,6 @@ In your AppHost project, install the .NET Aspire Azure App Service Hosting libra dotnet add package Aspire.Hosting.Azure.AppService ``` -## Configure Azure Provisioning for local development - -Adding Azure resources to the .NET Aspire application model will automatically enable development-time provisioning -for Azure resources so that you don't need to configure them manually. Provisioning requires a number of settings -to be available via .NET configuration. Set these values in user secrets in order to allow resources to be configured -automatically. - -```json -{ - "Azure": { - "SubscriptionId": "", - "ResourceGroupPrefix": "", - "Location": "" - } -} -``` - -> NOTE: Developers must have Owner access to the target subscription so that role assignments -> can be configured for the provisioned resources. - ## Usage example In the _AppHost.cs_ file of `AppHost`, add an Azure App Service Environment and publish your project as an Azure App Service website: @@ -91,11 +71,11 @@ The Azure App Service Environment resource creates the underlying infrastructure var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env"); ``` -By default, the Aspire Dashboard is included in the App Service Environment. To disable the dashboard: +By default, the Aspire Dashboard is included in the App Service Environment. To disable the dashboard, use the `WithDashboard` extension method: ```csharp -var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env"); -appServiceEnvironment.Resource.EnableDashboard = false; +var appServiceEnvironment = builder.AddAzureAppServiceEnvironment("env") + .WithDashboard(enable: false); ``` ## Additional documentation