Skip to content

Fixing bugs for sticky slot app settings#13693

Merged
eerhardt merged 14 commits intodotnet:mainfrom
ShilpiRach:deploymentslotfix
Jan 8, 2026
Merged

Fixing bugs for sticky slot app settings#13693
eerhardt merged 14 commits intodotnet:mainfrom
ShilpiRach:deploymentslotfix

Conversation

@ShilpiRach
Copy link
Contributor

@ShilpiRach ShilpiRach commented Dec 23, 2025

Description

Current behavior

When an Aspire project is deployed, all the app service and slots are deployed with app settings that are not sticky to the deployment slots. When slot swap is done, the app settings also get swapped as expected.

This results in incorrect behavior for these cases:

  • Otel service name - The telemetry from production starts showing up for the slot it is swapped with.
  • App Service dependencies - The production slot of a service should continue to refer to the production slot of dependent services after the swap (similarly, all stage / dev slot app services should reference other stage / dev slot services, which get created together).

Description of the fix

  • We are making the slots for otel service name and app service dependencies as specific to deployment slots. These will not get swapped on slot swap operation.
  • Updated the Azure.Provizioning.AppService version to 1.3.1 which adds support for SlotConfigNames.
  • Fixes another issue with the creation of host names by correctly truncating web app and slot names in case they are longer than the allowed length. Host name creation logic.
    • Without slot, the maximum length can be 60 characters. No change
    • With slot, the web app name is truncated to 40 characters. It is then concatenated to "-{slot name}". The concatenated string is then truncated to 59 characters.

Fixes #13660

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
Copy link
Contributor

github-actions bot commented Dec 23, 2025

🚀 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 -- 13693

Or

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

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Dec 23, 2025
@ShilpiRach ShilpiRach marked this pull request as ready for review January 6, 2026 17:19
Copilot AI review requested due to automatic review settings January 6, 2026 17:19
Copy link
Contributor

Copilot AI left a 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 fixes a critical bug where Azure App Service deployment slot settings were not correctly configured as "sticky" (slot-specific), causing telemetry and app service dependencies to get mixed up after slot swaps. The fix ensures that OTEL_SERVICE_NAME and service dependency app settings remain specific to each deployment slot and do not swap during slot operations.

Key Changes

  • Updated Azure.Provisioning.AppService package from version 1.3.0 to 1.3.1 to support SlotConfigNames configuration
  • Added SlotConfigNames resource creation to mark specific app settings as sticky to deployment slots
  • Automatically marks OTEL_SERVICE_NAME and all app service endpoint reference settings as slot-sticky
  • Fixed hostname generation logic to properly truncate web app and slot names (max 40 chars for prefix when using slots, 59 chars total with slot suffix)
  • Refactored dashboard and Application Insights configuration methods to accept app settings lists directly instead of web site objects, reducing code duplication
  • Fixed typo: renamed computerEnv to computeEnv throughout the codebase

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

File Description
Directory.Packages.props Updates Azure.Provisioning.AppService package version from 1.3.0 to 1.3.1
src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs Core implementation: adds SlotConfigNames resource, marks OTEL_SERVICE_NAME and endpoint references as sticky, refactors configuration methods
src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebSiteResource.cs Fixes typo (computerEnv→computeEnv), improves hostname truncation logic with proper constants
tests/Aspire.Hosting.Azure.Tests/Snapshots/*.verified.bicep (17 files) Updates test snapshots to include new slotConfigNames resource with appropriate sticky app settings

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

I just had some minor comments/feedback. This looks good.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM. Nice work!

@eerhardt eerhardt merged commit d85cba7 into dotnet:main Jan 8, 2026
286 checks passed
@eerhardt
Copy link
Member

eerhardt commented Jan 8, 2026

/backport to release/13.1

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Started backporting to release/13.1: https://github.com/dotnet/aspire/actions/runs/20830264615

@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Jan 8, 2026
@ShilpiRach ShilpiRach changed the title [Testing] Fixing bugs for sticky slot app settings Fixing bugs for sticky slot app settings Jan 9, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using AppService deployment slots results in mixed up telemetry

5 participants