I have an Azure Function App with two deployment slots. Is there a PowerShell command to swap deployment slots with preview?
Asked
Active
Viewed 293 times
1 Answers
0
After reproducing from our end, you can use the below powershell commands to swap the slots with preview.
Switch-AzWebAppSlot -ResourceGroupName $rg -Name $site -SourceSlotName staging -DestinationSlotName production -SwapWithPreviewAction ApplySlotConfig
the above command applies the current staging slot's setting values to the target slot
and then use the below command to finish the swap
Switch-AzWebAppSlot -ResourceGroupName $rg -Name $site -SourceSlotName staging -DestinationSlotName production -SwapWithPreviewAction CompleteSlotSwap
REFERENCES:

SwethaKandikonda
- 7,513
- 2
- 4
- 18
-
I have Azure Function Apps. Could I use these commands for function apps? – user989988 Jun 09 '22 at 23:43
-
I tried the above commands however app settings are set incorrectly. When I swap with preview via Azure Portal, app settings are set correctly. Why is that? – user989988 Jun 10 '22 at 23:28
-
How do I verify that 1st command has run successfully before running the above 2nd command in PowerShell? – user989988 Jun 13 '22 at 22:28
-
@user989988, after performing the first command you can check with ```$stagingSite = Get-AzWebAppSlot -ResourceGroupName $rg -Name $site -Slot staging $stagingSite.SiteConfig.AppSettings``` and see the app setting values have changed. – SwethaKandikonda Jun 13 '22 at 23:55