Share via

Azure Monitor log alert firing repeatedly for a single Automation runbook completion event

Bipin Kadam 60 Reputation points
2026-06-03T02:44:09.21+00:00

We have an Azure Monitor Log Search Alert configured for an Azure Automation runbook that restarts an Azure App Service twice daily.

This alert has worked correctly for a long time and historically generated one alert notification per runbook execution.

Starting on 01-Jun-2026, the same alert began firing multiple times for a single runbook execution, generating multiple email notifications every ~5 minutes.

Current Setup

Runbook Schedule

Restart web app at 08:00 JST every day

Restart web app at 20:30 JST every day

Alert Query

AzureDiagnostics
| where ResourceProvider == "MICROSOFT.AUTOMATION"
| where Category == "JobLogs"
| where ResultType == "Completed"
| where RunbookName_s == "Restart-MyApp-Runbook"
| project TimeGenerated, RunbookName_s, ResultType, ResourceId, JobId_g

Alert Configuration

Measurement: Table rows

Aggregation: Count

Aggregation granularity: 5 minutes

Threshold: Count >= 1

Evaluation frequency: 5 minutes

Evaluation period: 5 minutes (1 aggregated point)

Action: Send email

Expected Behavior

Historically, one runbook execution generated one alert.

Example:

31-May-2026: Alert fired once around 08:09 JST

Actual Behavior

On 01-Jun-2026, a single runbook execution generated repeated alert notifications at approximately 5-minute intervals.

Example times (JST):

20:34

20:39

20:44

20:49

20:54

20:59

21:04

Each alert firing resulted in multiple email notifications being sent.

Validation Performed

We checked the underlying Log Analytics data and found:

Only one Automation Job ID exists during the relevant time window

Only one completed record exists for that Job ID

Runbook executed only once

This does not appear to be caused by multiple runbook executions or duplicate log records.

Questions

Have there been any recent backend/platform changes in Azure Monitor Scheduled Query Alerts, alert state handling, or Azure Automation logs that could explain this behavior?

Under this configuration, is it expected that a Scheduled Query Alert continues firing every evaluation cycle even when only a single matching log record exists?

Has anyone observed similar behavior with Azure Automation JobLogs and Scheduled Query Rules?

Are there any known issues or recommendations to prevent duplicate alert notifications for a single runbook completion event?

Any guidance would be appreciated. Thanks.

Azure Monitor
Azure Monitor

An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.


1 answer

Sort by: Most helpful
  1. Jerald Felix 13,255 Reputation points Volunteer Moderator
    2026-06-03T04:40:26.99+00:00

    Hello Bipin Kadam,

    Greetings! Thanks for raising this question in Q&A forum.

    The reason this is happening is that your Log Search Alert is configured as a stateless alert. This means Azure Monitor does not remember that it already fired for the same condition so every time it evaluates the query (every 5 minutes) and still finds that one matching log record within the lookback window, it fires the alert again. This behavior may have become more consistent due to recent backend changes in Azure Monitor's Scheduled Query Rules engine around June 2026.

    Here's how you can fix this:

    Step 1: Switch to a Stateful Alert

    Go to your Alert Rule in the Azure Portal and edit it. Under the "Alert logic" section, look for the option "Automatically resolve alerts" and enable it. This makes the alert stateful — once it fires, it won't fire again until the condition clears and re-triggers.

    Step 2: Adjust the Aggregation Granularity and Evaluation Period

    Since your runbook runs twice a day, there's no need to evaluate every 5 minutes. Update the settings like this:

    • Aggregation granularity: 15 or 30 minutes
    • Evaluation frequency: 15 or 30 minutes
    • Evaluation period: 30 minutes

    This reduces the chance of the same log record being caught in multiple evaluation windows.

    Step 3: Add a Time-Based Filter to Your Query

    Narrow the query so it only picks up records from a fresh window. For example, add this line to your KQL query:

    | where TimeGenerated >= ago(6m)
    

    This ensures only very recent records are matched, so once the record ages out of that window, the alert stops firing.

    Step 4: Use the "Mute actions" (Suppress Alerts) Option

    In the Alert Rule, set "Mute actions for" to something like 60 minutes. This prevents repeated notifications even if the alert keeps evaluating as true.

    Step 5: Verify the Fix

    After saving, wait for the next scheduled runbook execution (08:00 or 20:30 JST) and confirm that only one email notification is received.

    To directly answer your questions yes, this is expected behavior for a stateless alert with a short evaluation window. There have been platform-side changes in Azure Monitor's Scheduled Query Rules that can make this more pronounced. The fix is primarily switching to stateful mode and widening your evaluation window.

    If this answer helps you kindly accept the answer which will help others who have similar questions.

    Best Regards,

    Jerald Felix.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.