1

I'm using VSO to continuously deploy to azure.

I have three slots :

  • Staging ( for automated tests )
  • AutoSwap ( if the version passes the automated tests in staging, it's deployed to AutoSwap )
  • Production ( When AutoSwap is deployed, it will auto swaps with Production ).

The problem is that my deployments are done using FTP ( I can't do it otherwise because it's an Asp.net Core 1.0 app ), so when I deploy to AutoSwap, it's not detected as an actual deployment so no auto swap is done with production.

My question : Is there any powershell command that I can call from the TFS task to start that auto swapping ? ( A command to tell for example that a deployment has been done which I can call when the FTP uploading ends ) ?

EDIT I have found and tried this but it does simply nothing ( it doesn't fail ) :

Switch-AzureWebsiteSlot -Name "MyApp" -Slot1 "production" -Slot2 "AutoSwap" -Force

yeska
  • 619
  • 1
  • 8
  • 23
  • MS provides a way to deploy Asp.net Core App with web deploy from VSTS you may want to try: https://msdn.microsoft.com/en-us/library/vs/alm/build/azure/deploy-aspnet5 – Eddie Chen - MSFT Mar 24 '16 at 02:51
  • I used to deploy with this but it doesn't work yet for RC2, and with FTP and powershell I have the this feeling of freedom and knowing exactly what happens behind the scenes. – yeska Mar 24 '16 at 10:06

2 Answers2

0

Try to use the Move-AzureDeployment, which swaps the deployments in production and staging.

Parameter Set: Default
Move-AzureDeployment [-ServiceName] <String> [ <CommonParameters>]

More details you can refer the link from MSDN: Move-AzureDeployment

Note: This applies only to cloud services, not web apps. The difference between Web APP and cloud service: Web App vs Cloud Service

Update

This may caused by the azure powershell script loads from VSO online does not support swap-slot. Try to remove the Azure powershell module, and import a different one.

See the answer from Ryan P in this MSDN link: https://social.msdn.microsoft.com/Forums/windows/en-US/0f30b76b-7954-4558-a10d-6a2b6635765a/switchazurewebsiteslot-does-not-work-in-vso-online

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • This may caused by the azure powershell script loads from VSO online does not support swap-slot. Please see my updated answer. – PatrickLu-MSFT Mar 24 '16 at 10:37
  • I tried to put this before the Switch-AzureWebsiteSlot but it didn't help : Remove-Module Azure Import-Module "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1" – yeska Mar 25 '16 at 08:12
0

The problem was that I'm using this utility to upload the files via FTP :

https://marketplace.visualstudio.com/items?itemName=januskamphansen.ftpupload-task

In its code there is this line which should be commented to not to block azure commands in the tasks following it :

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$CurrentSession.ignoreCert}

Now everything works great, It took me one week to find it, I hope that this answer will save time to someone.

yeska
  • 619
  • 1
  • 8
  • 23