根据工作日安排 Azure Function

Schedule Azure Function according to weekday

我想将我的 Azure Functions 安排为: 11:00 AM for Monday to Friday , 2:30 AM for Saturday & Sunday

如何为此编写 cron 表达式?

请帮忙。

不幸的是,您需要两个 azure 函数

public static void RunMonFriday([TimerTrigger("0 0 11 * * 1-5")]TimerInfo 
myTimer, ILogger log) { 
   // Call method to job
}
public static void RunSatSun([TimerTrigger("0 30 2 * * 6-7")]TimerInfo m
yTimer, ILogger log){
   // Call method to job
}

您可以尝试在管道中使用 Invoke Azure function with 环境。

这是一个例子:

在 Azure devops 中配置 schedule in your pipeline。 这是一个例子:

    # YAML file in the main branch
schedules:
- cron: "0 0 * * *"
  displayName: Daily midnight build
  branches:
    include:
    - master
- cron: "0 12 * * 0"
  displayName: Weekly Sunday build
  branches:
    include:
    - master