Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion src/frontend/src/content/docs/whats-new/aspire-13-6.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,49 @@ Azure Front Door origin names generated by the Aspire hosting integration now co
2. Confirm that the newly named origins are healthy and serve the intended backends.
3. Manually delete the old origins from each affected origin group.

**Fallback:** If the recommended deployment and cleanup approach isn't feasible, preserve the previous default origin names by overriding them with `ConfigureInfrastructure` before the first deployment after upgrading:
**Fallback:** If the recommended deployment and cleanup approach isn't feasible, preserve the previous default origin names by overriding them in an infrastructure customization callback before the first deployment after upgrading:

Both snippets extend an existing AppHost: `builder` is your application builder, and `api` is an existing backend resource with external HTTP endpoints and an Azure compute environment configured for publishing, such as Azure Container Apps or Azure App Service. Add the override before building and running your application.

<Tabs syncKey='aspire-lang'>
<TabItem id='typescript' label='TypeScript'>

Add the CDN provisioning package to enable typed origin lookups. It also includes the Azure Front Door hosting integration, so a separate `aspire add azure-frontdoor` isn't required:

```bash title="Add CDN provisioning support"
aspire add Aspire.Hosting.Azure.Provisioning.Cdn --version %ASPIRE_VERSION_PREVIEW%
```

These provisioning APIs are experimental and may change in future releases. This example was validated with Aspire 13.6.0 and CDN provisioning package version `13.6.0-preview.1.26479.8`.

```typescript title="apphost.mts" twoslash
import { createBuilder } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();
const api = await builder.addProject('api', '../Api/Api.csproj');
// ---cut---
const frontdoor = await builder.addAzureFrontDoor('frontdoor');
await frontdoor.withOrigin(api);
await frontdoor.configureInfrastructure(async (infrastructure) => {
const bicep = await infrastructure.bicep();
const groupId = await bicep.member(await bicep.resourceGroup(), 'id');
const suffix = await bicep.uniqueString([groupId]);

for (const origin of await infrastructure.getFrontDoorOrigins()) {
// Match the previous default: remove underscores and hash only the resource-group ID.
const identifier = await origin.bicepIdentifier();
const prefix = await bicep.string(`${identifier.replaceAll('_', '')}-`);
const name = await bicep.concat([prefix, suffix]);
// Front Door origin names have a maximum length of 90 characters.
await origin.name.set(await bicep.take(name, 90));
}
});
```

</TabItem>
<TabItem id='csharp' label='C#'>

Use the Azure Front Door hosting integration already installed in your AppHost (`Aspire.Hosting.Azure.FrontDoor`).

```csharp title="AppHost.cs"
using Azure.Provisioning;
Expand All @@ -914,8 +956,13 @@ builder.AddAzureFrontDoor("frontdoor")
});
```

</TabItem>
</Tabs>

The callback runs after the integration's defaults and applies to every configured origin. This override opts out of hostname-based origin identity, so switching backends no longer creates a new origin; if the new naming scheme has already been deployed, applying the override doesn't delete the newly created origins, so disable or remove unwanted origins separately after confirming which origins should serve traffic.

To verify the override without deploying, run `aspire publish --non-interactive` in your AppHost directory and inspect the generated Front Door Bicep module. Each origin's `name` should use `uniqueString(resourceGroup().id)` without the backend hostname and be truncated to 90 characters.

<LearnMore>
See the [Azure Front Door
integration](/integrations/cloud/azure/azure-front-door/) documentation.
Expand Down
Loading