How do deployment slot settings work on an Azure App Service?
Asked Answered
M

1

43

For a given web app service, when multiple deployment slots are setup, e.g.:

myapp

myapp/staging

and I create an appSetting that is marked as a "deployment slot setting" on myapp, what happens when I swap slots? Does the deployment slot setting stay with myapp or does it move to myapp/staging?

Also, what happens if I mix and match deployment slot settings and non-deployment slot settings between deployment slots?

Malachy answered 20/5, 2021 at 20:28 Comment(2)
It's insane to me that the Azure Portal doesn't make the answer to this very clear. Even reading their documentation leaves one more confused.Bilek
@TheMuffinMan yeah that's why I self answered here. I've had to come back to this Q&A multiple times to remind myself how things work.Malachy
M
78

Marking a setting as a "deployment slot setting" keeps it sticky to that particular deployment slot - e.g. an app setting marked as a "deployment slot setting" on myapp will always stick with myapp and will never move to myapp/staging during a swap. If the setting is not set as a deployment slot setting, it will move from myapp to myapp/staging during a swap.

AppSettings are NOT shared or synced across deployment slots. If you want an app setting on more than one slot, you need to add it to all of the slots in question with the same value (assuming you want the same value across all slots).

In terms of mixing & matching whether or not a given app setting is a deployment slot setting, Azure won't let you do this - it's last in wins. For example, if you have an app setting named myAppSetting that is present on more than one slot and you mark it as a deployment slot setting on any one of them, it will be changed to a deployment slot on the others as well, and vice versa. Worth noting that there's no warning or error message when you do this, it just happens silently.

Malachy answered 20/5, 2021 at 20:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.