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,

http://contoso-web.azurewebsites.net/
http://contoso-web-staging.azurewebsites.net/

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.

Deployment slots in Azure website 1

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.

Deployment slots in Azure website 2

FIGURE 2 Adding a deployment slot named Staging using the management portal

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

Deployment slots in Azure website 3

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

Creating an Azure website

Creating an Azure website using  Portal, Powershell and CLI Creating an Azure website on Microsoft Azure Cloud starts with creating ...
Read More

Deployment slots in Azure website

Defining deployment slots in Azure website Deployment slots in Azure website are collection of individual Azure website linked to your ...
Read More

Publishing an Azure website

Publishing an Azure website using various methods For publishing an Azure website, the web application or code needs to be ...
Read More

WebJobs in Azure website

Introduction to WebJobs in Azure website and Deployment using Portal and Powershell Web Jobs in Azure websites are exclusive applications ...
Read More

Azure website settings

Introduction to Configuring the azure website settings The first step you will need to follow for an Azure website is to ...
Read More
Loading...

Practice Tests in this course are

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5 This page shows the instructions for Exam 70-533 ...
Read More
Loading...