App Service Swap - weirdness with Environment variables

David Thielen 3,211 Reputation points
2024-02-21T16:19:17.15+00:00

Hi all;

When I go to swap the dev slot with production, and I do the swap command in the dev slot, I'm getting some unexpected behavior in the environment variables. After the swap:

  • In the production slot it is as I expect
    • dev slot - Deployment slot setting [x] - not moved/swapped to production
    • production slot - Deployment slot setting [x] - not moved/swapped to production
    • dev slot - Deployment slot setting [ ] - copied to production
    • production slot, and no matching dev slot entry for this variable - Deployment slot setting [ ] - deleted. So a Deployment slot setting [ ] is a move (not copy) and the original production value is removed from production and there's no original dev value for that variable and so gone.
  • In the dev slot, not exactly what I expect
    • dev slot - Deployment slot setting [x] - not moved/swapped to dev
    • production slot - Deployment slot setting [x] - not moved/swapped to dev
    • production & dev slot - Deployment slot setting [ ] - still the original value
    • production slot, no matching dev slot entry for this variable - Deployment slot setting [ ] - not copied across
    • dev slot, no matching production slot entry for this variable - Deployment slot setting [ ] - not deleted.

However the connection strings, which are all Deployment slot setting [ ], did swap each getting the other's values.

So why didn't it swat the Deployment slot setting [ ] from production to dev?

thanks - dave

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,703 questions
{count} votes

Accepted answer
  1. brtrach-MSFT 17,656 Reputation points Microsoft Employee
    2024-02-24T23:33:24.7966667+00:00

    @David Thielen The connection strings since they were not stickied, moved as expected. They are a resource as highlight below that will swap.

    Settings that are swapped:

    • General settings, such as framework version, 32/64-bit, web sockets
    • App settings (can be configured to stick to a slot)
    • Connection strings (can be configured to stick to a slot)
    • Handler mappings
    • Public certificates
    • WebJobs content
    • Hybrid connections *
    • Service endpoints *
    • Azure Content Delivery Network *
    • Path mappings

    Features marked with an asterisk (*) are planned to be unswapped. Settings that aren't swapped:

    • Publishing endpoints
    • Custom domain names
    • Non-public certificates and TLS/SSL settings
    • Scale settings
    • WebJobs schedulers
    • IP restrictions
    • Always On
    • Diagnostic settings
    • Cross-origin resource sharing (CORS)
    • Virtual network integration
    • Managed identities and related settings
    • Settings that end with the suffix EXTENSION

    Source

    In regard to the other settings that are not stickied and did not swap, it's possible that the app settings are not being swapped because they are not present in both the source and target slots. When you swap deployment slots, only the settings that are present in both slots are swapped. If an app setting is present in one slot but not the other, it will not be swapped. Can you confirm this for us please? We look forward to your reply.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.