Azure Function Scheduled Task Example (Timer Trigger)

If you have not added a function application in the Azure App Service Portal, you can refer to the article "Dynamics 365 triggers the call to Azure Function" to add and configure it. You can also refer to this article for the code publishing steps.

Create an Azure Function project in VS

Add Azure Functions to the project

Insert image description here

Select Timer Trigger, and the Schedule on the right is the execution cycle of the scheduled task, which is executed every 5 minutes by default. Cron expressions are used in this place. For specific syntax or generation, please refer to Online verification and generation of Cron expressions

Insert image description here
The following is an empty example after adding. I set it to run every 10 minutes, publish it to Azure, and monitor the running records in the log (for publishing and monitoring, you can also refer to the article "Dynamics 365 Triggers Calling Azure Function").

Insert image description here

In the Azure function application management center, you can see the corresponding released new functions in the function navigation.

Insert image description here

Enter the monitoring and view the completed log

Insert image description here

Log details

Insert image description here

You can also manually trigger the corresponding function, as shown below, click "Test/Run"

Insert image description here

If you need to call the timer trigger for VS debugging, after starting to run, it will appear as shown in the figure below, directly add a breakpoint in the code, and wait for the trigger period set by the timer to enter the breakpoint.

Insert image description here

Guess you like

Origin blog.csdn.net/tantu666/article/details/131832714