-
Notifications
You must be signed in to change notification settings - Fork 708
Add support to enable automatic scaling for App Service Environment #12305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12305Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12305" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables automatic scaling for Azure App Service Plans by default to improve performance and avoid cold start issues. The change introduces a new WithAutomaticScaling extension method that allows customers to opt out if needed.
Key changes:
- Automatic scaling is now enabled by default for App Service Plans
- New
WithAutomaticScaling(bool)extension method allows disabling the feature - App Service Plan configuration now includes
elasticScaleEnabled,perSiteScaling, andmaximumElasticWorkerCountproperties - Dashboard configuration includes scale limit settings to ensure single-instance operation
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| AzureAppServiceEnvironmentExtensions.cs | Adds WithAutomaticScaling extension method and updates App Service Plan configuration logic |
| AzureAppServiceEnvironmentResource.cs | Adds EnableAutomaticScaling internal property with default value of true |
| AzureAppServiceEnvironmentUtility.cs | Updates dashboard site configuration to include scale limits |
| AzureAppServiceTests.cs | Adds test for disabling automatic scaling |
| *.verified.bicep | Updates snapshot tests to reflect new automatic scaling properties |
| /// <summary> | ||
| /// Configures whether automatic scaling should be enabled for the app services in Azure App Service environment. | ||
| /// </summary> | ||
| /// <param name="builder">The AzureAppServiceEnvironmentResource to configure.</param> | ||
| /// <param name="enable">Whether to enable automatic scaling. Default is true.</param> | ||
| /// <returns><see cref="IResourceBuilder{T}"/></returns> |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XML documentation is incomplete for a public API. According to Aspire's documentation standards, public APIs require comprehensive documentation including <remarks> and <example> sections. Add a <remarks> section explaining when/why to use this method and an <example> section showing practical usage with code.
src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentExtensions.cs
Show resolved
Hide resolved
| /// </summary> | ||
| /// <param name="builder">The AzureAppServiceEnvironmentResource to configure.</param> | ||
| /// <param name="enable">Whether to enable automatic scaling. Default is true.</param> | ||
| /// <returns><see cref="IResourceBuilder{T}"/></returns> |
Copilot
AI
Oct 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value documentation should follow the standard pattern for fluent APIs: "A reference to the <see cref="IResourceBuilder{T}"/> for chaining additional configuration."
src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentResource.cs
Show resolved
Hide resolved
|
@ShilpiRach thanks for the contribution. I'm not sure that we'll take this change but I'm interested in @davidfowl and @maddymontaquila for input. My issue with the change is really twofold:
Whilst we would want applications to be able to scale up, the app first needs to work correctly and its something that developers will need to assess on a case by case basis. |
|
@mitchdenny - is your main concern about making automatic scaling the default option? If yes, I am fine with making it non-default. Tagging @btardif to comment on your first comment about higher cost - who might have more data about this. For the 2nd point, Applications deployed on cloud should usually work with scaling out. But you might be right about existing Aspire customers trying out App Service. |
Made this change |
|
Thanks @ShilpiR. Just need to decide if we want to add this to the API surface now. We don't do these scaling options anywhere else. |
Description
This PR adds support to enable automatic scaling for the Azure App Service Plan not enabled by default. This option is made available as it is considered a best practice to improve an app's performance and avoid cold start issues.
The change introduces an extension method
WithAutomaticScalingfor the AzureAppServiceEnvironment to enable automatic scaling. Customers can enable it withWithAutomaticScaling()orWithAutomaticScaling(true).Testing
WithAutomaticScaling(false)to ensure the properties related to PerSiteScaling are set correctly for the app service plan and app services.Relevant properties for App Service Plan:
Relevant properties for App Service
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate