title: How to read the CRON expression from appsettings.json at runtime?
body: <p>I have developed web job project which is having multiple timer trigger functions. Each function is executed at different time of the day. Some of them are executed every minute ,some every five minute and some of them once in a day. </p>
  
  <p>If I write the CRON expression in the function parameter attribute itself like<br>
  <code>ProcessTrigger2([TimerTrigger("0 */3 * * * *", RunOnStartup = false)]TimerInfo timerInfo)</code>  , it works as expected but when I try it to read from appsettings.json it fails. </p>
  
  <p>Could anyone suggest the right way of reading the appsettings.json in Functions.cs ??</p>
  
  <p>Following is the code that I am trying.</p>
  
  <p>Program.cs</p>
  
  <pre><code>internal class Program
     {
          // Please set the following connection strings in app.config for this WebJob to run:
          // AzureWebJobsDashboard and AzureWebJobsStorage
          private static void Main()
          {
              ServiceCollection services = new ServiceCollection();
              ConfigureServices(services);
  
              var config = new JobHostConfiguration();
              config.JobActivator = new JobActivator(services.BuildServiceProvider());
              config.UseTimers();
  
              if (config.IsDevelopment)
              {
                  config.UseDevelopmentSettings();
              }
  
              var host = new JobHost(config);
              // The following code ensures that the WebJob will be running continuously
              host.RunAndBlock();
          }
  
          private static IConfiguration Configuration { get; set; }
  
          private static void ConfigureServices(IServiceCollection services)
          {
              var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
  
              Configuration = new ConfigurationBuilder()
                  .SetBasePath(Directory.GetCurrentDirectory())
                  .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                  .AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true)
                  .AddEnvironmentVariables()
                  .Build();
  
              services.AddSingleton(Configuration);
              services.AddTransient&lt;Functions, Functions&gt;();
              services.AddLogging(builder =&gt; builder.AddConsole());
          }
      }
  </code></pre>
  
  <p>Functions.cs</p>
  
  <pre><code>public class Functions
      {
          private readonly ILogger&lt;Functions&gt; logger;
  
          private readonly IConfiguration configuration;
  
          public Functions(ILogger&lt;Functions&gt; logger, IConfiguration configuration)
          {
              this.configuration = configuration;
              this.logger = logger;
          }
  
  
          [FunctionName("TimerTriggerEveryMinute")]
          public void ProcessTrigger1([TimerTrigger("%TimerTriggerEveryMinute:Schedule%")]TimerInfo timerInfo)
          {
              var ab = this.configuration;
              Console.WriteLine(string.Format("{0} Proc 1",DateTime.Now));
          }
  
          [FunctionName("TimerTriggerEveryThirdMinute")]
          public void ProcessTrigger2([TimerTrigger("0 */3 * * * *", RunOnStartup = false)]TimerInfo timerInfo)
          {
              Console.WriteLine(string.Format("{0} Proc 2",DateTime.Now));
          }
  
          [FunctionName("TimerTriggerEveryFiveMinute")]
          public void ProcessTrigger3([TimerTrigger("%EveryFiveMinuteSchedule%",RunOnStartup =false)]TimerInfo timer)
          {
              Console.WriteLine(string.Format("{0} Proc 5", DateTime.Now));
          }
  }
  </code></pre>
  
  <p>JobActivator.cs</p>
  
  <pre><code> public class JobActivator : IJobActivator
      {
          private readonly IServiceProvider services;
  
          public JobActivator(IServiceProvider services)
          {
              this.services = services;
          }
  
          public T CreateInstance&lt;T&gt;()
          {
              return services.GetService&lt;T&gt;();
          }
      }
  </code></pre>
  
  <p>appsettings.json</p>
  
  <pre><code>{
    "Logging": {
      "LogLevel": {
        "Default": "Warning"
      }
    },
    "ConnectionStrings": {
      "AzureWebJobsDashboard": "My Azure Dashboard key here...",
      "AzureWebJobsStorage": "My Azure Job Storage key here...",
    },
    "TimerTriggerEveryMinute": {
      "Schedule": "0 * * * * *"
    },
    "TimerTriggerEveryFiveMinute": {
      "Schedule": "0 */5 * * * *"
    }
  }
  
  </code></pre>
  
  <p>In above code, in Functions.cs, if I write the timer trigger in<br>
  <code>ProcessTrigger2([TimerTrigger("0 */3 * * * *", RunOnStartup = false)]TimerInfo timerInfo)</code> this manner for all methods, the job works as expected but if I write in other two manners it gives me the exception.
  Please suggest the write way of reading the schedule from appsettings.json.</p>