Dessus
Dessus

Reputation: 2177

Azure Powershell: Website slot swapping not working predictably

I have found azure slot swapping via powershell seems to be unrealiable (I imagine it is giving an error response that I can't see or is silently failing but claiming success). The slots being swapped are between two non production slots as shown in the script. About 10% of the time it seems to succeed. Im not sure why it succeeds or fails, hopefully someone can shed some light on what I am doing wrong here.

I have a script I have made that runs on a build job on Teamcity and the script is as follows:

param ([string]$publishFilePath = "%system.teamcity.build.checkoutDir%\3. 
deployment\Fu.publishsettings")

Import-AzurePublishSettingsFile $publishFilePath;
Select-AzureSubscription "Visual Studio Professional with MSDN";
Set-AzureSubscription -SubscriptionName "Visual Studio Professional with MSDN";

Switch-AzureWebsiteSlot -Name FuWebsite -Slot1 Build-Automation -Slot2 Staging -Force -Verbose
Switch-AzureWebsiteSlot -Name FuServices -Slot1 Build-Automation -Slot2 Staging -Force -Verbose

The only logs I get are:

[10:20:12][Step 5/5] VERBOSE: Performing the operation "Swapping website 
production slot ..." on 
[10:20:12][Step 5/5] target "FuWebsite".
[10:21:16][Step 5/5] VERBOSE: Performing the operation "Swapping website production slot ..." on 
[10:21:16][Step 5/5] target "FuMeServices".
[10:22:19][Step 5/5] 
[10:22:19][Step 5/5] 
[10:22:19][Step 5/5] Process exited with code 0

Upvotes: 0

Views: 334

Answers (1)

Jambor - MSFT
Jambor - MSFT

Reputation: 3293

About 10% of the time it seems to succeed. Im not sure why it succeeds or fails

If you not sure whether it succeed or fail. I would suggest you test below code with -Debug mode.

Switch-AzureWebsiteSlot -Name FuWebsite -Slot1 Build-Automation -Slot2 Staging -Force -Verbose -Debug

Here is the result I get on my side: enter image description here

The detailed information will help you to find out the solution. In addtion, if you execute the swap command, however the site does not change. Please try to clean IE sessions and cookies then try again. Or use KUDU to see the original file is changed or not.

Upvotes: 1

Related Questions