Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Powershell script to swap Azure App Service (website) deployment slots

Tags:

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
like image 442
Jeff Treuting Avatar asked Apr 21 '15 07:04

Jeff Treuting


People also ask

What are deployment slots in Azure App Service?

Suppose we have one azure app service with endpoint production.azurewebsites.net where we have deployed an application and is in production. With the deployment slots feature, we can add another slot which is a full-fledged app service with different end point URL like production-stg.azurewebsites.net.

What is the default routing rule applied to new deployment slots?

By default, new slots are given a routing rule of 0% , shown in grey.


2 Answers

Could this be what you're looking for?

Switch-AzureWebsiteSlot [[-Name] <String> ] [[-Slot1] <String> ] [[-Slot2] <String> ] [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
like image 125
StegMan Avatar answered Sep 28 '22 12:09

StegMan


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

like image 36
Jeff Treuting Avatar answered Sep 28 '22 12:09

Jeff Treuting