Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I have a staging site for my Azure web app with its own database?

I have an MVC website that is connected to an azure web app and has continuous deployment to a staging site set up. It works great! After I check in, the successful build is automatically deployed to the staging slot of my webapp. After I verify that staging looks good, I can swap the two slots to make prod into stage and vice versa.

Recently I decided that I wanted the production and staging slots to connect to distinct databases so that I can enter test data into the staging site without cluttering the prod database.

I naively though I could do this by editing the connection strings in the configuration for the staging site to point to a new database. It seemed to work, but the next time I swapped configurations after a deploy, I realized that the connection strings get swapped in the process. This is not what I was aiming for.

Does anyone know how I can have the two deployment slots point to different databases and to maintain those connections after the swap? Is there another way I should be thinking of this?

like image 311
DanJosef Avatar asked Jan 06 '16 02:01

DanJosef


People also ask

How do I make a website on Azure Web App?

Create a Website in Azure Management PortalStep 1 − Login to your management portal. Step 2 − Click 'New' at the left bottom corner of the screen → Compute → Web Apps → Quick Create. Step 3 − Enter the details as shown in the picture above and click 'Create Web App'.

What is staging in Azure?

Bulk Loading from Microsoft Azure A stage specifies where data files are stored (i.e. “staged”) so that the data in the files can be loaded into a table.


1 Answers

Azure provides the answer here. I copy-edited their text below.

Some configuration elements will follow the content across a swap (not slot specific) while other configuration elements will stay in the same slot after a swap (slot specific).

Luckily, connection strings can be configured to stick to a slot. To configure a connection string to stick to a slot (not swapped), access the Application Settings blade for a specific slot, then select the Slot Setting box for the configuration elements that should stick the slot.

enter image description here

like image 124
Maria Ines Parnisari Avatar answered Sep 20 '22 18:09

Maria Ines Parnisari