How to use Azure Deployment Slots? It’s all about a DNS game!

Hello,

It’s now more difficult to work on release life cycle and specially in Azure if you work with others.

Microsoft made a concept called Azure Deployment Slots, I will explain you in this post how this working.

Basically, Deployment Slots consist of having another container where you can deploy your code, a staging container for instance.

You can then push your staging code to the site and do a rollback if the testing does not succeed.

Basically when you create a Deployment Slots on your App Service this looks like:

1

You can then download the publishing profile of the container “Staging” but also “Production” and start to deploy your code.

Imagine now you have to perform a release on your App Service, you then deploy your code on the “Staging” environment and you want to make it available with the “Production DNS”, in the case of a SharePoint Provider Hosted App the DNS is really important.

You will perform a Swap action in the Azure Portal:

swap

 And the platform will look like:

2

Now, the “Staging DNS” will point the “Production” container and the “Production DNS” will point the “Staging” container.

So great you can test your app and in case if bug re-swap to have your “Production” container linked to your “Production DNS” again.

But, now you find that there is no bug in your app so you want to push to production really.

You will then open your Visual Studio and re-deploy your web project, but now with the publishing profile of the “Production” container as you might have done before. But by default, Visual Studio deploy using the URL of the site and then passing via the DNS, but we just changed the DNS with the Swap. Meaning that with this action you will only update the “Staging” container (currently on production) even if you use the “Production” publishing profile!

The best practice:

When you did the swap and all is working perfectly, the best is to leave as it is.

Then when you want to upload a new version of your site, you have to simply deploy with Visual Studio using the staging publishing profile, swap again and see if this working.

You have to keep in mind that this is to deploy your code and this is not working like a TFS Branch.

 

Advertisements
This entry was posted in Azure and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s