Slot Swap with Preview enables us to run production specific app setting and database connection string in a slot website. This allows us to completely test the new deployment with actual production setting. Slot Swap with Preview also allows us to execute warm-up code so that website doesn't have any slow perf issues due to cold start.
There are three main phases in Slot Swap with Preview :
We can do Slow Swap with Preview using Azure Portal as shown below. Note : select the right slot for source.
Here are PS cmdlets to execute Slot Swap with Preview
$AzureWebsiteName = "azinsights" $AzureRGName = "InternalConsumptionResourceGroup" $From = "test" $To = "production"
#Switch-AzureWebsiteSlot -Name $AzureWebsiteName -Slot1 $From -Slot2 $To -Force -Verbose
Switch-AzureRmWebAppSlot -ResourceGroupName $AzureRGName -Name $AzureWebsiteName -SourceSlotName $From -DestinationSlotName $To -SwapWithPreviewAction ApplySlotConfig
Switch-AzureRmWebAppSlot -ResourceGroupName $AzureRGName -Name $AzureWebsiteName -SourceSlotName $From -DestinationSlotName $To -SwapWithPreviewAction CompleteSlotSwap
Switch-AzureRmWebAppSlot -ResourceGroupName $AzureRGName -Name $AzureWebsiteName -SourceSlotName $From -DestinationSlotName $To -SwapWithPreviewAction ResetSlotSwap |
Before executing Apply Slot Config PS cmdlets, here are process ID and AppDomain ID of source and destination slot websites :
Production Slot |
Test Slot |
|
|
After executing Apply Slot Config PS Cmdlet, test slot website recycled and now using production database. Destination slot is untouched.
Production Slot |
Test Slot |
|
|
After executing Complete Slot Swap PS Cmdlet, production slot website has same process id as previous test slot website . And the new test slot website recycled and now using test database.
Production Slot |
Test Slot |
|
|
More Info
Azure Web App Deployment Slot Swap with PreviewYou must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.