Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switching from one connectionstring to another when moving from development to cloud

Tags:

azure

I am working on a cloud application. When I test out the application on my computer I want to have my connection string set as follows in ServiceConfiguration.cscfg:

<Setting name="DataConnectionString" value="UseDevelopmentStorage=true" />

When I publish to the cloud I need to have it set as follows:

<Setting name="DataConnectionString" value="DefaultEndpointsProtocol=https;AccountName=xxxx;AccountKey=yyy" />

I keep going from one environment to the other and keep having to change the DataConnectionString.

Is there a way that I can automate this? I looked around and can't see any examples but I'm sure some others have the same problem as me.

Thanks,

Nancy

like image 686
Nancy Walker Avatar asked Feb 26 '11 07:02

Nancy Walker


2 Answers

I've answered a similar question here:

Visual Studio 2010 can apply Debug or Release transformations to Web.config, but what about the Azure settings?

like image 143
Igorek Avatar answered Sep 30 '22 16:09

Igorek


While Igorek's approach works perfectly we prefer to make such kind of transformations on our CI server which is also responsible for automatic deployment. The main reason is to restrict access to sensitive data, since only limited number of trusted developers have access to CI server. Also, it helps to keep our code cleaner, since it doesn't include redundant config project. In our case we use Hudson-CI (Jenkins-CI) and MSBuild.ExtensionPack.FileSystem.File (replace action) to transform config files.

like image 39
Anton Moiseev Avatar answered Sep 30 '22 17:09

Anton Moiseev