Found a little handy way of debugging TimerTrigger Azure functions locally. If you don’t want to wait for minutes for your TimerTrigger to execute, you can use the "/admin" apis for Azure Functions.
When you run this locally while locally debugging in Visual Studio or Visual Studio Code, it will trigger the function immediately instead of waiting for the time to elapse.
Here’s an example I used:
1
| curl -v -X POST http://localhost:7247/admin/functions/MyTimerTriggerFunction -H "Content-Type: application/json" -d "{}"
|
The reply should be something like:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| * Host localhost:7247 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
* Trying [::1]:7247...
* Trying 127.0.0.1:7247...
* Connected to localhost (127.0.0.1) port 7247
* using HTTP/1.x
> POST /admin/functions/MyTimerTriggerFunction HTTP/1.1
> Host: localhost:7247
> User-Agent: curl/8.12.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 2
>
* upload completely sent off: 2 bytes
< HTTP/1.1 202 Accepted
< Content-Length: 0
< Date: Tue, 13 May 2025 18:12:24 GMT
< Server: Kestrel
<
* Connection #0 to host localhost left intact
|
Then if you look at the console logs of your Functions application you will see that your function with the TimerTrigger executed.