title: Retrieve and use Windows Azure's connection strings?
body: <p>I've configured connection strings in Azure management portal Configure->Connection Strings (linked resources):</p>
  
  <p><a href="https://i.stack.imgur.com/L1qz4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L1qz4.png" alt="enter image description here"></a></p>
  
  <p>What are these connection strings useful for?</p>
  
  <p>I tried deleting the conn. strings from web.config file, so it should read from here, but it doesn't.</p>
  
  <p>Is there any other way?</p>
  
  <p>Basically I want these connection strings to override the connection strings in web.config to be used in production environment.</p>
  
  <p>I've added the following to the <code>Application_Start</code> method:</p>
  
  <pre><code>var sb = new StringBuilder();
  var appConfig = ConfigurationManager.OpenMachineConfiguration();  
  foreach (ConnectionStringSettings conStr in appConfig.ConnectionStrings.ConnectionStrings)
    sb.AppendFormat("Name: {0}, ConnectionString: {1}\n", conStr.Name, conStr.ConnectionString);
  throw new Exception(sb.ToString());
  </code></pre>
  
  <p>Here's the result:</p>
  
  <blockquote>
    <p>Name: LocalSqlServer, ConnectionString: data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true</p>
  </blockquote>
  
  <p>I tried the above with <code>ConfigurationManager.ConnectionStrings</code> as well and the server (Azure) connection strings were not there.</p>