'Deployment slots in Azure FunctionApp

I'm trying to understand how deployment slot works (https://docs.microsoft.com/en-us/cli/azure/webapp/deployment?view=azure-cli-latest).

I ran the following command in order to create a new staging slot:

az functionapp deployment slot create --name MyFunctionapp --resource-group MyResourceGroup --slot staging

And I see two deployment slots in 'Running' state. Is it supposed to run only 1 slot at a time? If so, how do I stop one?

enter image description here

I have a few app settings in Configuration. What does this checkbox indicate? Please help me understand.

enter image description here



Solution 1:[1]

Is it supposed to run only 1 slot at a time?

No, they are both supposed be running. When you create a staging slot, you now have 2 instances of your app running. One is your staging slot (where you can first test your application before swapping it with production), and the other is the production slot. see : https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots#add-a-slot

I have a few app settings in Configuration. What does this checkbox indicate? The checkbox indicates whether or not the app config value is a slot setting. if the app config value is a slot setting, then it is not updated when a swap happens between say staging and production. But if it is not a slot setting, and you swap production with staging, then the app config value in your staging environment with override the value in the production app config. In other words, selecting this check box tells App Service that the setting is not swappable. see : https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots#which-settings-are-swapped

Solution 2:[2]

Deployment Slot Settings checked means this setting is sticked to the slot.
So when you swap from staging to production and this flag is checked on staging this configuration will not be used on production.

You can set standard configurations like this. (No flag in UI)

az functionapp config appsetings set -g EVGroupused" -n "evgadmin" -s staging --settings CosmosDbConnectionString=$cosmosdbConnectionString 

The same configuration but with flag checked.

az functionapp config appsetings set -g EVGroupused" -n "evgadmin" -s staging --slot-settings CosmosDbConnectionString=$cosmosdbConnectionString 

So: --settings versus --slot-settings It took me a while to figure this out.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rimaz Mohommed
Solution 2 njefsky