Skip to content

Derive Azure Front Door origin names from backend hostnames - #20035

Merged
Eric Erhardt (eerhardt) merged 1 commit into
mainfrom
eerhardt-front-door-origin-names
Sep 10, 2026
Merged

Derive Azure Front Door origin names from backend hostnames#20035
Eric Erhardt (eerhardt) merged 1 commit into
mainfrom
eerhardt-front-door-origin-names

Conversation

@eerhardt

@eerhardt Eric Erhardt (eerhardt) commented Sep 10, 2026

Copy link
Copy Markdown
Member

Description

Azure Front Door origins currently retain the same Azure name when an Aspire compute resource resolves to a different backend hostname between deployments. Include the hostname in the origin's name so switching backends creates a distinct origin instead of reusing the existing origin's Azure identity.

Combine the resource-group ID and hostname in a single uniqueString suffix, retain a readable resource-based prefix, and use FrontDoorOrigin.GetResourceNameRequirements().MaxLength for the name limit. Add a production comment explaining the rationale and update the single- and multiple-origin Bicep snapshots.

Endpoint, origin-group, and route names remain unchanged. Existing deployments receive new origin names the first time this naming scheme is applied.

Examples

AppHost configuration is unchanged:

var frontDoor = builder.AddAzureFrontDoor("frontdoor")
    .WithOrigin(api);
const frontDoor = await builder.addAzureFrontDoor("frontdoor")
    .withOrigin(api);

Generated origin name before:

name: take('apiOrigin-${uniqueString(resourceGroup().id)}', 90)

Generated origin name after:

name: take('apiOrigin-${uniqueString(resourceGroup().id, api_host)}', 90)

Breaking changes

This is a breaking deployment change for existing users of the Azure Front Door integration, even though the integration is still in preview. Upgrading changes origin resource names even when the backend hostname has not changed. Incremental ARM deployments do not remove resources omitted from the new template, so existing origins can remain alongside the newly named origins in the same origin group.

To preserve the previous default origin names, override them with ConfigureInfrastructure before the first deployment after upgrading:

using Azure.Provisioning;
using Azure.Provisioning.Cdn;
using Azure.Provisioning.Expressions;

builder.AddAzureFrontDoor("frontdoor")
    .WithOrigin(api)
    .ConfigureInfrastructure(infrastructure =>
    {
        foreach (var origin in infrastructure.GetProvisionableResources()
            .OfType<FrontDoorOrigin>())
        {
            // Match the previous default: remove underscores and hash only the resource-group ID.
            origin.Name = BicepFunction.Take(
                BicepFunction.Interpolate($"{origin.BicepIdentifier.Replace("_", "")}-{BicepFunction.GetUniqueString(BicepFunction.GetResourceGroup().Id)}"),
                origin.GetResourceNameRequirements().MaxLength);
        }
    });

The callback runs after the integration's defaults and applies to every configured origin. Removing underscores, rather than replacing them with hyphens, preserves the old prefix exactly: for example, my_apiOrigin becomes myapiOrigin.

This override opts out of hostname-based origin identity changes. If the new naming scheme has already been deployed, applying the override does not delete the newly created origins; disable or remove the unwanted origins separately after confirming which origins should serve traffic. Users keeping the new naming scheme likewise need to account for cleanup of origins left behind by incremental deployments.

Validation

All 13 AzureFrontDoorTests passed, including the updated Bicep snapshots. Quarantined and outerloop tests were excluded.

Fixes # (issue)

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

Include the backend hostname and resource group in the origin name hash so changing compute backends creates a distinct origin. Respect SDK name requirements and update the Bicep snapshots.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20035

Or

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

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot September 10, 2026 17:00
@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Sep 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

2 / 99 PR test projects · 2 PR jobs · 1 advisory-only target, from 3 changed files.

Selected PR test projects (2 / 99)

Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Tests

Selected PR jobs (2)

extension-e2e, typescript-api-compat

Advisory workflow impact (1)

  • deployment-e2e (schedule/dispatch-only)

How these were chosen — grouped by what changed

🧪 tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureFrontDoorTests.AddAzureFrontDoorWithMultipleOriginsGeneratesBicep.verified.bicep (changed test)
1 directly: Aspire.Hosting.Azure.Tests
1 via the project graph: Aspire.Hosting.Azure.Kubernetes.Tests

🔧 src/Aspire.Hosting.Azure.FrontDoor/AzureFrontDoorExtensions.cs (changed source)
1 directly: Aspire.Hosting.Azure.Tests

🧪 tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureFrontDoorTests.AddAzureFrontDoorWithSingleOriginGeneratesBicep.verified.bicep (changed test)
1 directly: Aspire.Hosting.Azure.Tests

Job reasons

Job Triggered by
deployment-e2e affected project Aspire.Hosting.Azure.FrontDoor
extension-e2e src/Aspire.Hosting.Azure.FrontDoor/AzureFrontDoorExtensions.cs
• affected project Aspire.Hosting.Azure.FrontDoor
typescript-api-compat affected project Aspire.Hosting.Azure.FrontDoor

Selection computed for commit 2aa42f2.

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.

🟡 Changes recommended

Incremental deployments retain the old origin in the unchanged origin group, potentially continuing to route traffic to the previous backend.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates Azure Front Door origin naming so backend hostname changes produce distinct Azure origin identities.

Changes:

  • Adds backend hostname to the origin-name hash.
  • Uses Azure’s origin-name length limit.
  • Updates single- and multiple-origin Bicep snapshots.
File summaries
File Description
src/Aspire.Hosting.Azure.FrontDoor/AzureFrontDoorExtensions.cs Revises generated origin names.
tests/...SingleOriginGeneratesBicep.verified.bicep Updates single-origin snapshot.
tests/...MultipleOriginsGeneratesBicep.verified.bicep Updates multiple-origin snapshot.
Review details

Suppressed comments (1)

src/Aspire.Hosting.Azure.FrontDoor/AzureFrontDoorExtensions.cs:134

  • This does not safely switch the backend during a redeployment. Aspire submits these templates with ArmDeploymentMode.Incremental, so the previous physical origin is retained when this hash produces a new name. Because the origin-group name stays unchanged and the route targets that group, both the old and new origins remain members; Front Door can continue probing and routing traffic to the old backend. Include the hostname-derived identity in the origin group and repoint the route, or explicitly remove the obsolete origin as part of deployment.
                origin.Name = BicepFunction.Take(
                    BicepFunction.Interpolate($"{originBicepId.Replace('_', '-')}Origin-{BicepFunction.GetUniqueString(BicepFunction.GetResourceGroup().Id, hostParam)}"),
                    origin.GetResourceNameRequirements().MaxLength);
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread src/Aspire.Hosting.Azure.FrontDoor/AzureFrontDoorExtensions.cs
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@eerhardt Eric Erhardt (eerhardt) added the breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. label Sep 10, 2026
@eerhardt
Eric Erhardt (eerhardt) merged commit fbbb8ad into main Sep 10, 2026
245 of 251 checks passed
@eerhardt
Eric Erhardt (eerhardt) deleted the eerhardt-front-door-origin-names branch September 10, 2026 18:04
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.6 milestone Sep 10, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #1646

Generated by PR Documentation Check · auto · 96.7 AIC · ⌖ 15.9 AIC · ⊞ 18.3K

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#1646 targeting release/13.6.

Updated the Azure Front Door integration doc and the Aspire 13.6 "What's new" page to cover the origin-naming breaking change:

  • src/frontend/src/content/docs/integrations/cloud/azure/azure-front-door.mdx — updated the generated Bicep sample to uniqueString(resourceGroup().id, my_api_host), added a caution callout for the 13.6 upgrade, and added a "Preserve origin names from before Aspire 13.6" section with the ConfigureInfrastructure override.
  • src/frontend/src/content/docs/whats-new/aspire-13-6.mdx — added a "Front Door origin identity" bullet under Integration updates and a new breaking-change entry describing the hostname-based origin naming and the override to restore pre-13.6 names.

Note

This draft PR needs human review before merging.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Analysis: Possible Flaky Test(s)

The CI build failed due to test failure(s) that appear unrelated to the PR changes. These may be flaky tests.

Suspected flaky test(s):

Suggested actions:

  • Re-run the failed CI jobs to confirm if the failure is intermittent
  • If the test continues to fail, consider quarantining it using /quarantine-test <test name> <issue URL>
  • Search existing issues to see if this test is already known to be flaky

You can re-run the failed jobs from the workflow run page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-integrations Issues pertaining to Aspire Integrations packages breaking-change Issue or PR that represents a breaking API or functional change over a prerelease.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants