title: How to use ConfigurationBuilder staticly in an Azure Function v2 (core)?
body: <p>While porting an Azure Function from v1 to v2 there is a change in how the configuration manager is used to read the local.settings.json. </p>
  
  <p>Previously, I used the following code to enable redis connection pooling between function instances:</p>
  
  <pre><code>public static class Redis
  {
      /// &lt;summary&gt;
      /// Initializes the REDIS connection.
      /// &lt;/summary&gt;
      private static readonly Lazy&lt;ConnectionMultiplexer&gt; LazyConnection = new Lazy&lt;ConnectionMultiplexer&gt;(() =&gt;
      {
          return ConnectionMultiplexer.Connect(ConfigurationManager.AppSettings["CacheConnection"]);
          });
  
      public static IDatabase Database =&gt; LazyConnection.Value.GetDatabase();
  }
  </code></pre>
  
  <p>However in v2 the ConfigurationManager is no longer available and we have to use something like:</p>
  
  <pre><code>new ConfigurationBuilder()
          .SetBasePath(context.FunctionAppDirectory)
          .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
          .AddEnvironmentVariables()
          .Build();
  </code></pre>
  
  <p>However, because it requires the <code>context</code> which is only available during function runtime we cannot create a static class shared across all functions. Is it possible to read the app.settings.json statically in Azure Functions v2?</p>