Question 535 of 1,170
Implement and Manage Virtual NetworkingmediumMultiple ChoiceObjective-mapped

AZ-104 Diagnostic Settings Practice Question

This AZ-104 practice question tests your understanding of implement and manage virtual networking. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. A key principle to apply: diagnostic Settings. 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.

Exhibit

Goal: Centralized logging server = 192.0.2.50

A network team wants to send diagnostic logs from an Azure VPN gateway to a Log Analytics workspace. Which command should be used to configure this?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "which command"

    Why it matters: Tests specific CLI syntax. Recall the exact command and its required context — near-synonyms and partial matches are common distractors.

Exhibit

Goal: Centralized logging server = 192.0.2.50

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

New-AzDiagnosticSetting -ResourceId $gw.Id -WorkspaceId $ws.Id

The correct command is 'New-AzDiagnosticSetting -ResourceId $gw.Id -WorkspaceId $ws.Id' (option B) because it creates a diagnostic setting for the specified Azure resource (VPN gateway) to stream logs to the specified Log Analytics workspace. This is the Azure-native way to forward logs to a centralized monitoring solution. Option D, 'Add-AzLogAnalyticsSolution', adds a management solution (like VPN Gateway solution) to a workspace, but it does not configure diagnostic logging from a specific resource; it only enables log collection for the solution type if logs are already flowing. Therefore, option B is the correct approach.

Key principle: Diagnostic Settings

Answer analysis

Option-by-option breakdown

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

  • Set-AzVpnGateway -LoggingConfiguration

    Why it's wrong here

    Incorrect. 'Set-AzVpnGateway' is used to modify VPN gateway properties like SKU or connections, but it does not have a -LoggingConfiguration parameter for sending logs to Log Analytics.

    When this WOULD be correct

    If the exam question specified that the routers needed to send SNMP traps to a management system for monitoring purposes, then 'snmp-server host 192.0.2.50' would be the correct command to configure the SNMP trap destination.

  • New-AzDiagnosticSetting -ResourceId $gw.Id -WorkspaceId $ws.Id

    Why this is correct

    Correct. Creates a diagnostic setting that routes logs and metrics from the VPN gateway to a Log Analytics workspace.

    Clue confirmation

    The clue word "which command" in the question point toward this answer.

    Related concept

    Diagnostic Settings

  • Set-AzVNetGateway -DiagnosticLogging

    Why it's wrong here

    Incorrect. 'Set-AzVNetGateway' is used to configure virtual network gateway settings, but it does not have a -DiagnosticLogging parameter.

    When this WOULD be correct

    If the exam question asked about configuring a router to synchronize its clock with a time server for logging purposes, then 'ntp server 192.0.2.50' would be the correct command to ensure accurate timestamps in log messages.

  • Add-AzLogAnalyticsSolution

    Why it's wrong here

    Incorrect. 'Add-AzLogAnalyticsSolution' installs a management solution (e.g., 'Azure VPN Gateway' solution) into a Log Analytics workspace, but it does not configure diagnostic settings for individual resources; diagnostic settings must be created separately.

Option-by-option analysis

Why each answer is right or wrong

Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AZ-104 exam frequently reuses these exact scenarios with slightly different constraints.

New-AzDiagnosticSetting -ResourceId $gw.Id -WorkspaceId $ws.IdCorrect answer

Why this is correct

Correct. Creates a diagnostic setting that routes logs and metrics from the VPN gateway to a Log Analytics workspace.

Set-AzVpnGateway -LoggingConfigurationWrong answer — click to see why

Why this is wrong here

The command 'snmp-server host 192.0.2.50' is used to configure a Simple Network Management Protocol (SNMP) trap destination, not for sending log messages. Therefore, it does not fulfill the requirement of sending logs to a centralized server.

★ When this WOULD be the correct answer

If the exam question specified that the routers needed to send SNMP traps to a management system for monitoring purposes, then 'snmp-server host 192.0.2.50' would be the correct command to configure the SNMP trap destination.

Why candidates choose this

Candidates might be tempted to choose this option because they associate centralized logging with network management protocols, leading them to mistakenly think SNMP is relevant for logging purposes.

Set-AzVNetGateway -DiagnosticLoggingWrong answer — click to see why

Why this is wrong here

The command 'ntp server 192.0.2.50' is used to configure a Network Time Protocol server for time synchronization, not for sending log messages to a centralized server.

★ When this WOULD be the correct answer

If the exam question asked about configuring a router to synchronize its clock with a time server for logging purposes, then 'ntp server 192.0.2.50' would be the correct command to ensure accurate timestamps in log messages.

Why candidates choose this

Candidates may confuse logging with time synchronization, leading them to select this option because they recognize the importance of accurate time for log entries, even though it does not directly address the logging requirement.

Analysis generated from the official AZ-104blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

Common exam traps

Common exam trap: answer the scenario, not the keyword

Candidates often assume that adding a management solution (e.g., VPN Gateway solution) via 'Add-AzLogAnalyticsSolution' will automatically start collecting logs from all VPN gateways. However, this cmdlet only adds the solution to the workspace; you still need to configure diagnostic settings for each resource to send logs to the workspace.

Detailed technical explanation

How to think about this question

Syslog messages are sent as UDP datagrams to port 514 by default, and the 'logging host' command can be repeated to send logs to multiple servers. The router's logging severity level (from emergencies at level 0 to debugging at level 7) is controlled separately via 'logging trap <level>', and without it, only messages at the default level (informational and above) are sent. In real-world scenarios, centralized logging is critical for security auditing and troubleshooting, and syslog servers like Kiwi Syslog or SolarWinds parse these messages for alerting.

KKey Concepts to Remember

  • Diagnostic Settings

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

Diagnostic Settings

Real-world example

How this comes up in practice

A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.

What to study next

Got this wrong? Here's your next step.

Review diagnostic Settings, then practise related AZ-104 questions on the same topic to reinforce the concept.

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?

Implement and Manage Virtual Networking — This question tests Implement and Manage Virtual Networking — Diagnostic Settings.

What is the correct answer to this question?

The correct answer is: New-AzDiagnosticSetting -ResourceId $gw.Id -WorkspaceId $ws.Id — The correct command is 'New-AzDiagnosticSetting -ResourceId $gw.Id -WorkspaceId $ws.Id' (option B) because it creates a diagnostic setting for the specified Azure resource (VPN gateway) to stream logs to the specified Log Analytics workspace. This is the Azure-native way to forward logs to a centralized monitoring solution. Option D, 'Add-AzLogAnalyticsSolution', adds a management solution (like VPN Gateway solution) to a workspace, but it does not configure diagnostic logging from a specific resource; it only enables log collection for the solution type if logs are already flowing. Therefore, option B is the correct approach.

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

Review diagnostic Settings, then practise related AZ-104 questions on the same topic to reinforce the concept.

Are there clue words in this question I should notice?

Yes — watch for: "which command". Tests specific CLI syntax. Recall the exact command and its required context — near-synonyms and partial matches are common distractors.

What is the key concept behind this question?

Diagnostic Settings

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

Keep practising

More AZ-104 practice questions

Last reviewed: Jun 30, 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.