The issue is not inside my script ! My script works. I tried with a simple test script, I kept the default script generated by Azure and added one Write-Host :
# Input bindings are passed in via param block.
param($Timer)
# Get the current universal time in the default string format.
$currentUTCtime = (Get-Date).ToUniversalTime()
# The 'IsPastDue' property is 'true' when the current function invocation is later than scheduled.
if ($Timer.IsPastDue) {
Write-Host "PowerShell timer is running late!"
}
# Write an information log with the current time.
Write-Host "PowerShell timer trigger function ran! TIME: $currentUTCtime"
Write-Host "Function works"
I kept the default trigger generated by Azure (function.json)
{
"bindings": [
{
"name": "Timer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */5 * * * *"
}
]
}
And it does not work ! I get this log :
2025-06-03T07:20:26Z [Information] Executing 'Functions.TimerTrigger1' (Reason='This function was programmatically called via the host APIs.', Id=04ec27a3-8ab9-4e65-bd33-d55f12f9250d)
2025-06-03T07:20:26Z [Error] Executed 'Functions.TimerTrigger1' (Failed, Id=04ec27a3-8ab9-4e65-bd33-d55f12f9250d, Duration=12ms)
By editing the schedule ONLY and defining " */59 * * * * * ", it works !
2025-06-03T07:37:03Z [Information] Executing 'Functions.TimerTrigger1' (Reason='This function was programmatically called via the host APIs.', Id=80095f9d-a513-45cc-bb2c-105b9e3eb9ce)
2025-06-03T07:37:03Z [Verbose] Sending invocation id: '80095f9d-a513-45cc-bb2c-105b9e3eb9ce
2025-06-03T07:37:03Z [Verbose] Posting invocation id:80095f9d-a513-45cc-bb2c-105b9e3eb9ce on workerId:35896789-7614-4118-bf66-197868c1a7df
2025-06-03T07:37:03Z [Information] INFORMATION: PowerShell timer trigger function ran! TIME: 06/03/2025 07:37:03
2025-06-03T07:37:03Z [Information] INFORMATION: Function works
2025-06-03T07:37:03Z [Information] Executed 'Functions.TimerTrigger1' (Succeeded, Id=80095f9d-a513-45cc-bb2c-105b9e3eb9ce, Duration=32ms)
The issue is not in the script ... I don't understand why this behavior ...
Could it be related to my App Service Plan ? I'm using "Y1", and a "Consumption" hosting plan.