从配置中读取Azure功能设置

时间:2017-11-05 12:35:11

标签: azure azure-functions

我正在使用Azure Functions with Attributes来定义功能。

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
    }
}

是否有办法为配置设置提取计划0 */5 * * * *,是Configuration Manager还是Environment Variables

谢谢!

1 个答案:

答案 0 :(得分:7)

是的,你可以做到

[TimerTrigger("%schedule%")]

然后添加名为schedule的设置,其值为0 */5 * * * *