Added check for single exposed port and handle startup command and target port in app service#12088
Merged
Merged
Conversation
…rget port for main container
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12088Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12088" |
davidfowl
reviewed
Oct 16, 2025
davidfowl
reviewed
Oct 16, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds support for propagating a single target port and startup command to the App Service main container while enforcing that only one target port is specified. Key changes:
- Enforces a single target port across endpoints and sets WEBSITES_PORT plus main container TargetPort.
- Moves command-line args from siteConfig.appCommandLine to mainContainer.startUpCommand.
- Adds tests covering args, target port usage, and rejection of multiple distinct target ports.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| AzureAppServiceTests.KeyvaultReferenceHandling.verified.bicep | Reorders main container resource placement; no functional change. |
| AzureAppServiceTests.AzureAppServiceSupportBaitAndSwitchResources.verified.bicep | Adds targetPort and WEBSITES_PORT app setting for validation. |
| AzureAppServiceTests.AddDockerfileWithAppServiceInfrastructureAddsDeploymentTargetWithAppServiceToContainerResources.verified.bicep | Adds targetPort and WEBSITES_PORT for container deployment scenario. |
| AzureAppServiceTests.AddAppServiceWithTargetPortMultipleEndpoints.verified.json | New snapshot manifest for multiple endpoints with same target port. |
| AzureAppServiceTests.AddAppServiceWithTargetPortMultipleEndpoints.verified.bicep | New bicep snapshot validating single target port across HTTP/HTTPS. |
| AzureAppServiceTests.AddAppServiceWithTargetPort.verified.json | New snapshot manifest for single target port scenario. |
| AzureAppServiceTests.AddAppServiceWithTargetPort.verified.bicep | New bicep snapshot adding WEBSITES_PORT for target port 9000. |
| AzureAppServiceTests.AddAppServiceWithArgs.verified.json | New snapshot manifest for startup command args scenario. |
| AzureAppServiceTests.AddAppServiceWithArgs.verified.bicep | New bicep snapshot showing startUpCommand generation. |
| AzureAppServiceTests.cs | Adds tests for args, single target port, multiple endpoints, and error on mismatched target ports. |
| AzureAppServiceWebsiteContext.cs | Implements target port enforcement, WEBSITES_PORT addition, and moves args to main container startUpCommand. |
davidfowl
reviewed
Oct 16, 2025
davidfowl
approved these changes
Oct 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
WithArgsextension on ProjectResource should be used to create the StartupCommand of the main container. This is a change due to use of new SITECONTAINERS config.WithHttpEndpointshould be set as the target port of the main container and WEBSITES_PORT app setting.Fixes #9659
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate