20

I'm looking for a way to use Azure PowerShell commands to do a deployment swap for an Azure App Service (previously Azure Websites). All of the posts I've seen say to use the command

Move-Deployment -ServiceName

but that appears to only be valid for cloud services and swapping between Production and Staging predefined slots.

I have a website with deployment slots that I've defined and I can use the following command to get information about the website site, but I don't see how to swap it:

Get-AzureWebsite -Name "sitenamehere" -Slot test
Jeff Treuting
  • 13,910
  • 8
  • 36
  • 47

2 Answers2

23

Could this be what you're looking for?

Switch-AzureWebsiteSlot [[-Name] <String> ] [[-Slot1] <String> ] [[-Slot2] <String> ] [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
StegMan
  • 513
  • 4
  • 7
  • Yes this is exactly what I needed. I had found a blog post finally and was posting an answer at the same time as you. Thanks! – Jeff Treuting Apr 24 '15 at 19:54
  • I noticed that! I also wanted to clarify after checking out the link you posted, my reading was from [here](https://msdn.microsoft.com/en-us/library/azure/dn722464.aspx) which stated the cmdlet could only be run on websites with two slots. After reading your link, I realized it simply throws an error if you have more than two slots and fail to specify which to switch. – StegMan Apr 24 '15 at 20:00
2

The solution is to use the command

Switch-AzureWebsiteSlot -Name "sitenamehere"

More details are provided in this blog post http://blogs.msdn.com/b/harikharan/archive/2015/01/01/swap-slots-in-azure-web-site-when-there-are-2-or-more-staging-slots-using-azure-powershell.aspx

Jeff Treuting
  • 13,910
  • 8
  • 36
  • 47