Question 297 of 1,170
Monitor and Maintain Azure ResourcesmediumMultiple ChoiceObjective-mapped

Quick Answer

The correct query is Heartbeat | where Computer == "VM01" | summarize LastHeartbeat = max(TimeGenerated) | where LastHeartbeat < ago(15m). This works because the alert must fire when a heartbeat is *missing*, not when one is present; by using `max(TimeGenerated)` to find the most recent heartbeat record, the `where LastHeartbeat < ago(15m)` clause evaluates to true only when that last timestamp is older than 15 minutes, meaning no heartbeat has arrived within the window. On the AZ-104 exam, this tests your understanding of log alert logic—specifically that alerts trigger on a query returning results, so you must write a query that returns rows only when the condition is violated. A common trap is using `ago(15m)` in a filter on raw records instead of summarizing first, which would incorrectly fire on any old heartbeat. Memory tip: think “summarize the max, then check if it’s too old”—if the max is old, the VM is cold.

AZ-104 Monitor and Maintain Azure Resources Practice Question

This AZ-104 practice question tests your understanding of monitor and maintain azure resources. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

In Log Analytics, you want an alert that fires if VM01 has not sent a Heartbeat record in the last 15 minutes. Which query should be used as the alert condition?

Question 1mediummultiple choice
Full question →

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Heartbeat | where Computer == "VM01" | summarize LastHeartbeat = max(TimeGenerated) | where LastHeartbeat < ago(15m)

Option B is correct because the alert must fire when VM01 has *not* sent a Heartbeat in the last 15 minutes. The query uses `max(TimeGenerated)` to find the most recent heartbeat, then filters with `where LastHeartbeat < ago(15m)` to detect records older than 15 minutes. This condition evaluates to true when the last heartbeat is older than the threshold, triggering the alert.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Heartbeat | where Computer == "VM01" | summarize LastHeartbeat = max(TimeGenerated) | where LastHeartbeat > ago(15m)

    Why it's wrong here

    This query finds a recent heartbeat, which means the VM is healthy rather than missing data.

  • Heartbeat | where Computer == "VM01" | summarize LastHeartbeat = max(TimeGenerated) | where LastHeartbeat < ago(15m)

    Why this is correct

    This query finds the most recent heartbeat for VM01 and compares it to the 15-minute threshold. If the latest heartbeat is older than that, the query returns a result that can be used to trigger an alert. That directly matches the requirement to detect when the VM has stopped reporting heartbeats.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Heartbeat | where Computer == "VM01" and TimeGenerated > ago(15m) | summarize count() by Computer

    Why it's wrong here

    This query only counts recent heartbeat records, so it does not surface the condition where the VM has stopped sending them.

  • Heartbeat | where Computer == "VM01" | summarize count() by bin(TimeGenerated, 15m)

    Why it's wrong here

    This query groups rows into time buckets, but it does not evaluate whether the latest heartbeat is stale or missing.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often confuse the comparison operator, choosing `>` (greater than) instead of `<` (less than), because they mistakenly think 'last heartbeat > 15 minutes ago' means it happened more than 15 minutes ago, when in fact `ago(15m)` returns a timestamp 15 minutes in the past, and a heartbeat older than that has a *smaller* timestamp value.

Detailed technical explanation

How to think about this question

Log Analytics alert rules evaluate queries at a specified frequency; the query must return zero results when the condition is not met and non-zero results when it is. The `ago(15m)` function uses the UTC time of the query execution, and `max(TimeGenerated)` aggregates the latest heartbeat timestamp per computer. Under the hood, the alert engine checks the number of rows returned — a non-zero result triggers the alert, so the query must be designed to return rows only when the condition (no recent heartbeat) is true.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

An e-commerce site experiences heavy traffic on Black Friday and near-zero traffic during off-peak weeks. Rather than provisioning permanent large VMs, the team uses auto-scaling groups that add capacity automatically under load and reduce it overnight. Questions like this test whether you understand elasticity, availability zones, and cloud compute scaling patterns.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related AZ-104 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free AZ-104 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this AZ-104 question test?

Monitor and Maintain Azure Resources — This question tests Monitor and Maintain Azure Resources — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Heartbeat | where Computer == "VM01" | summarize LastHeartbeat = max(TimeGenerated) | where LastHeartbeat < ago(15m) — Option B is correct because the alert must fire when VM01 has *not* sent a Heartbeat in the last 15 minutes. The query uses `max(TimeGenerated)` to find the most recent heartbeat, then filters with `where LastHeartbeat < ago(15m)` to detect records older than 15 minutes. This condition evaluates to true when the last heartbeat is older than the threshold, triggering the alert.

What should I do if I get this AZ-104 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more ways this is tested on AZ-104

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. Based on the exhibit, the operations team wants an alert that fires when any VM has not sent a heartbeat in the last 15 minutes. Which KQL query should they use as the condition for the log alert?

medium
  • A.Heartbeat | summarize LastSeen=max(TimeGenerated) by Computer | where LastSeen > ago(15m)
  • B.Heartbeat | summarize LastSeen=max(TimeGenerated) by Computer | where LastSeen < ago(15m)
  • C.Heartbeat | where TimeGenerated > ago(15m) | summarize count() by Computer | where count() == 0
  • D.Heartbeat | distinct Computer | where Computer == "VM01"

Why B: Option B is correct because the query uses `summarize max(TimeGenerated) by Computer` to get the latest heartbeat timestamp per VM, then filters with `where LastSeen < ago(15m)` to identify VMs whose last heartbeat is older than 15 minutes. This directly matches the alert condition: any VM that has not sent a heartbeat in the last 15 minutes.

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This AZ-104 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-104 exam.