title: Access connection strings in ASP.NET 5 on Azure
body: <p>In ASP.NET 5, how do we programmatically access an Azure Web App's connection strings? I've been able to retrieve the <code>TEST_APP_SETTINGS</code> value but not the <code>TestConnString</code> one.</p>
  
  <p><img src="https://i.stack.imgur.com/ncXll.png" alt="App Settings and Connection Strings"></p>
  
  <p>Here is what I have tried: </p>
  
  <pre><code>services.Configure&lt;AppSettings&gt;(Configuration.GetSubKey("AppSettings"));
  </code></pre>
  
  <p>I'm afraid that <code>AppSettings</code> doesn't exist. I've also done this and the app settings show up but the connection strings do not.</p>
  
  <p>Startup.cs</p>
  
  <pre><code>// Setup configuration sources.
  Configuration = new Configuration()
      .AddJsonFile("config.json")
      .AddEnvironmentVariables();
  
  // Allow access from *.cshtml
  services.AddSingleton&lt;Configuration&gt;(provider =&gt; 
  { 
      return Configuration as Configuration; 
  });
  </code></pre>
  
  <p>Dev.cshtml</p>
  
  <pre><code>@inject Microsoft.Framework.ConfigurationModel.Configuration config;
  
  &lt;dl&gt;
      @foreach(var k in @config.GetSubKeys())
      {
          &lt;dt&gt;@k.Key&lt;/dt&gt;
          &lt;dd&gt;@config.Get(k.Key)&lt;/dd&gt;
      }
  &lt;/dl&gt;
  </code></pre>