Skip to content

Add the ability to get a host address ReferenceExpression from an EndpointReference - #11931

Merged
David Fowler (davidfowl) merged 10 commits into
microsoft:mainfrom
eerhardt:EndpointEnhancements
Oct 21, 2025
Merged

David Fowler (davidfowl) merged 10 commits into
microsoft:mainfrom
eerhardt:EndpointEnhancements

Conversation

@eerhardt

@eerhardt Eric Erhardt (eerhardt) commented Oct 9, 2025 •

Copy link
Copy Markdown
Member

Description

When you have an EndpointReference, it is useful to decompose this EndpointReference into a ReferenceExpression that can be used as a parameter to other resources.

Implement a method on each IComputeEnvironmentResource that turns an EndpointReference for a compute target in that environment into a ReferenceExpression.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@github-actions

github-actions Bot commented Oct 9, 2025 •

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11931

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 11931"

@github-actions github-actions Bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Oct 9, 2025
…pointReference

When you have an EndpointReference, it is useful to decompose this EndpointReference into a ReferenceExpression that can be used as a parameter to other resources.

Implement a method on each IComputeEnvironmentResource that turns an EndpointReference for a compute target in that environment into a ReferenceExpression.
…he WebSite's suffix so it can produce the correct endpoint expression.
It isn't possible to tell if the ComputeResource targets this compute environment. So remove the checking. The ReferenceExpression returned will be in terms of the compute environment if the resource is deployed to that environment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for computing a host address ReferenceExpression from an EndpointReference for each compute environment.

  • Introduces GetHostAddressExpression on IComputeEnvironmentResource.
  • Implements environment-specific host computation logic (Kubernetes, Docker Compose, Azure Container Apps, Azure App Service) and updates Azure outputs (webSiteSuffix).
  • Adds tests validating the host address expressions and updates Bicep snapshots to include new outputs.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/Aspire.Hosting/ApplicationModel/IComputeEnvironmentResource.cs Adds new API method for resolving host address expressions.
src/Aspire.Hosting.Kubernetes/KubernetesEnvironmentResource.cs Implements host expression using service naming convention.
src/Aspire.Hosting.Docker/DockerComposeEnvironmentResource.cs Implements host expression using lowercase service name.
src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentResource.cs Implements host expression and exposes website suffix output.
src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentExtensions.cs Emits provisioning output for website suffix.
src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs Switches to shared website suffix logic.
src/Aspire.Hosting.Azure.AppContainers/AzureContainerAppEnvironmentResource.cs Implements internal/external domain host logic.
tests/Aspire.Hosting.Kubernetes.Tests/KubernetesEnvironmentResourceTests.cs Adds test for Kubernetes host expression.
tests/Aspire.Hosting.Docker.Tests/DockerComposeTests.cs Adds test for Docker Compose host expression.
tests/Aspire.Hosting.Azure.Tests/AzureContainerAppsTests.cs Adds test for Azure Container Apps host expression.
tests/Aspire.Hosting.Azure.Tests/AzureAppServiceTests.cs Adds test validating App Service host expression and output name.
tests/Aspire.Hosting.Azure.Tests/Snapshots/*.bicep Adds webSiteSuffix output to App Service environment snapshots.

Comment on lines +55 to +56
internal static BicepValue<string> GetWebSiteSuffixBicep() =>
BicepFunction.GetUniqueString(BicepFunction.GetResourceGroup().Id);

Copilot AI Oct 17, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent casing of 'WebSite' vs 'website' in property/output naming. Prefer 'WebsiteSuffix' (single word) and align the Bicep output name (e.g., websiteSuffix) for consistency with naming guidelines.

Copilot generated this review using guidance from repository custom instructions.
@davidfowl
David Fowler (davidfowl) merged commit 0446816 into microsoft:main Oct 21, 2025
@dotnet-policy-service dotnet-policy-service Bot added this to the 13.0 milestone Oct 21, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants