David Klempfner
David Klempfner

Reputation: 9870

Override <connectionStrings> during release pipeline

My Web.config looks like this:

<connectionStrings configSource="secretConnectionStrings.config">
  </connectionStrings>

secretConnectionStrings.config stores the DB connection string with the password and is not in source control.

I can see the following in the "Deploy Azure App Service" task:

configuration settings

How can I update my VSTS release pipeline so that the <connectionStrings> section is replaced with a connection string (including password) which I supply?

My repo is public which is why I don't want the password in there, and only trusted people have access to the VSTS account used to deploy.

Upvotes: 0

Views: 2364

Answers (1)

rickvdbosch
rickvdbosch

Reputation: 15551

Not entirely the answer you're looking for, but still an answer to your problem: have a look at what the Azure App Service ConnectionStrings settings under Application Settings do:

For .NET apps, these connection strings are injected into your .NET configuration connectionStrings settings at runtime, overriding existing entries where the key equals the linked database name.

Using this in a smart way enables you to have the setting just be present on the App Service, without the release pipeline even having to know them.

You could also, of course, have the release pipeline update the settings on the App Service. Because you can do XML Transformations with the Azure App Service Deploy task, you can remove the external file reference. Or remove it alltogether.

Also, have a look at my comment on your post

Upvotes: 1

Related Questions