Skip to content
Get started

How to monitor Azure Functions timer triggers

To monitor an Azure Functions timer trigger, keep schedule monitoring enabled (useMonitor, which defaults to true for schedules with a recurrence interval of one minute or greater) so each occurrence is persisted and Azure can detect and compensate for a missed execution. For alerting, use Application Insights to track function invocations and failure rates, and create an alert rule that fires when the function's execution count drops to zero over a period longer than its schedule interval.

What is useMonitor and why does it matter?

Azure Functions timer triggers have a useMonitor property that controls whether the schedule is persisted to a storage account. When useMonitor is true (the default for intervals of one minute or longer), Azure tracks each scheduled occurrence and can run a missed execution when the function app restarts after downtime:

function.json (in-process model)
{
  "type": "timerTrigger",
  "name": "myTimer",
  "schedule": "0 0 3 * * *",
  "useMonitor": true,
  "runOnStartup": false
}

With useMonitor: true, if the function app was down during a scheduled run, Azure will execute the missed run once when the app comes back up. With useMonitor: false, the missed run is skipped permanently.

How do I detect a failed or missed execution?

Application Insights tracks every function invocation. Create an alert rule in Azure Monitor that fires when the function's execution count over a sliding window is lower than expected:

Azure CLI — alert on zero executions in 25 hours
az monitor metrics alert create \
  --name "TimerTrigger-MissedRun" \
  --resource-group my-rg \
  --scopes /subscriptions/<sub>/resourceGroups/my-rg/providers/Microsoft.Web/sites/my-function-app \
  --condition "count requests < 1" \
  --window-size 25h \
  --evaluation-frequency 1h \
  --action-group my-action-group

How do I add a heartbeat from inside a timer function?

function_app.py (isolated worker model)
import azure.functions as func
import urllib.request

app = func.FunctionApp()
PING_URL = "https://ping.cronshield.com/<your-check-id>"

@app.timer_trigger(schedule="0 0 3 * * *", arg_name="myTimer",
                   use_monitor=True, run_on_startup=False)
def nightly_report(myTimer: func.TimerRequest) -> None:
    run_nightly_job()
    # Report success last. An exception above skips this.
    urllib.request.urlopen(PING_URL, timeout=10)
useMonitor / use_monitor is the persistence flag, not a monitoring service — it helps Azure recover missed runs, but it doesn't alert you. PING_URL is a placeholder for the endpoint you get on a monitor.

Add a missed-run alert to this job

The free tier gives you a heartbeat endpoint and an email alert when an expected ping doesn't arrive. Paid tiers add the log-aware diagnosis — the last log line and a likely cause in the alert. The heartbeat receiver ships in an upcoming release; see the plans to learn what each tier adds.

Frequently asked questions

What does runOnStartup do on an Azure Functions timer trigger?
When runOnStartup is true, the function executes once immediately when the function app starts, in addition to its normal schedule. This is useful for local testing but can cause duplicate runs in production if the function app restarts frequently. Set runOnStartup: false in production.
How do I view Azure Functions execution history?
In the Azure Portal, open your function app, select the function, and go to Monitor. If Application Insights is connected, you see each invocation with duration, status, and any exceptions. The Invocations tab shows recent runs with their trigger timestamps.