Defining deployment slots in Azure website
Deployment slots in Azure website are collection of individual Azure website linked to your production slot website. For instance, if you intend to develop your website using the name Contoso-web and adding a deployment slot named Staging, then the website identification for the staging slot will be Contoso-web-staging. You can access every website from its exclusive URL. For instance,
Each Azure website automatically contains one deployment slot referring to the production deployment slot. It’s probably the slot where the production version of your application will be deployed. You are free to add up to four deployment slots to your website. Once you have twice or more deployment slots, you can easily export the content of the deployment slots as updated versions of your application that are being created. Figure 1 shows the example of how the deployment slots for a website can be configured.
FIGURE 1 Example of how deployment slots can be used for different environmentsIf you are adding more deployment slots to Azure websites, you will need to set the website in standard mode.
Creating a deployment slot using the management portal
In the deployment section of the blade for the Azure website, you can see the number of deployment slots that are developed for the website. You can add more deployment slots by simply clicking the deployment slots part as demonstrated in Figure 2.
While creating a new deployment slot using the management portal, you will have an option of copying the present deployment slot or creating a new one using default values
Creating a deployment slot using Azure PowerShell
If you want to create a deployment slot by using Azure PowerShell cmdlets then consider using the New-AzureWebsite cmdlet. Afterward, insert the name of the existing website in the name box along with the name of the new deployment slot in the slot box. For instance:
$wsQASlot = "QA" New-AzureWebsite -Location $wsLocation -Name $wsName -Slot $wsQASlot
Swapping deployment slots
If you are exchanging deployment slots, keep in mind that you are also interchanging the content of one slot with another. One example is if you have version 2.0 of an application in your staging slot and version 1.0 of the application in the production slot, you can use deployment slots to test the version 2.0 application before taking it to the production step. Also, it provides you with a way of swapping back to the version 1.0 if required. Figure 3 shows interchanging between a production and staging setting
FIGURE 3 Swapping between production and staging deployment slotsYou can interchange deployment slots by using both the management portal and Azure PowerShell cmdlets
Swapping deployment slots using the management portal
If you want to swap deployment slots using the management portal, go to website blade for the Azure website and click on swap button. For more than one deployment slots, you will see another blade where you can choose the destination deployment slot to exchange with.
Swapping deployment slots using Azure PowerShell
For interchanging deployment slots by using Azure PowerShell, consider using the switch azure website slot cmdlet to exchange the slots as specified in the slot 1 and slot 2 parameters. For example, below is the code which shows an interchange between staging and production slots.
$wsStaging = "Staging" $wsProduction = "Production" Switch-AzureWebsiteSlot -Name $wsName -Slot1 $wsStaging -Slot2 $wsProduction
This article is a part of 70-533 Implementing Microsoft Azure Infrastructure Solutions Prep course.
More Articles included in this course are
Practice Tests in this course are