mattruma
mattruma

Reputation: 16677

Read Azure Function Setting from Configuration

I am using Azure Functions with Attributes to define functionality.

public static class PostPublishTimerTrigger
{
    [FunctionName("PostPublishTimerTrigger")]
    public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
        TraceWriter log,
        [Queue("post-published")] ICollector<string> postPublishedQueue)
    {
          // Additional code here
    }
}

Is there a way to pull the Schedule 0 */5 * * * * for a configuration setting, be it with Configuration Manager or Environment Variables?

Thanks!

Upvotes: 3

Views: 545

Answers (1)

Mikhail Shilkov
Mikhail Shilkov

Reputation: 35124

Yes, you can do

[TimerTrigger("%schedule%")]

and then add a setting called schedule with value 0 */5 * * * *

Upvotes: 8

Related Questions