azure - 从配置中读取 Azure 函数设置

标签 azure azure-functions

我使用带有属性的 Azure Functions 来定义功能。

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 * * * *,无论是使用配置管理器还是环境变量

谢谢!

最佳答案

是的,你可以

[TimerTrigger("%schedule%")]

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

关于azure - 从配置中读取 Azure 函数设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47121627/

相关文章:

azure - 如何配置 Quartz.net 以使用 Azure SQL 数据库来存储 ADOJobStore 详细信息

azure - 共享访问签名 Azure

c# - 如何使用 C# 更新 cosmos db 文档

azure - 如何在不使用 Azure API Gateway 的情况下在 Azure 函数应用程序 Http 触发器中控制消费者在给定时间段内对 API 的使用(节流)

Azure函数应用部署和发布管道错误

c# - 无论如何,是否可以在 azure 函数中使用 AddSecretClient DI 扩展?

c# - 静态文件不通过 .NET Core WebAPI 在 Azure WebApp 中提供

Azure DevOps 发布管道 Azure 订阅字段已禁用

c# - 如何在不将客户端 key 存储在 appsettings.json 中的情况下获取 Azure Key Vault key ?

azure - 更改我的 Azure 订阅租户 ID