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
A
Set-AzVpnGateway -LoggingConfiguration
Why wrong: 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.
Correct. Creates a diagnostic setting that routes logs and metrics from the VPN gateway to a Log Analytics workspace.
C
Set-AzVNetGateway -DiagnosticLogging
Why wrong: Incorrect. 'Set-AzVNetGateway' is used to configure virtual network gateway settings, but it does not have a -DiagnosticLogging parameter.
D
Add-AzLogAnalyticsSolution
Why wrong: 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.
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 (VPNgateway) 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 VPNgateway 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.
Correct. Creates a diagnostic setting that routes logs and metrics from the VPNgateway 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 VPNGateway' 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.
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., VPNGateway 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.
Related glossary terms
Concepts from this question explained
These glossary pages explain the core terms tested in this AZ-104 question in full detail.
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 →
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.
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.
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.
Sign in to join the discussion.