Recording Connection Attempts with NSG Flow Logs

AZ-104 By islever Editorial Last updated

Monitor resources in Azure Configure secure access to virtual networks

Short answer

ADE Enable Azure Network Watcher in East US, create an Azure Storage account, and register the Microsoft.Insights resource provider to support NSG flow logs.

Question

You have an Azure subscription named Subscription1 that has the following providers registered:
✑ Authorization
✑ Automation
✑ Resources
✑ Compute
✑ KeyVault
✑ Network
✑ Storage
✑ Billing
✑ Web
Subscription1 contains an Azure virtual machine named VM1 that has the following configurations:
✑ Private IP address: 10.0.0.4 (dynamic)
✑ Network security group (NSG): NSG1
✑ Public IP address: None
✑ Availability set: AVSet
✑ Subnet: 10.0.0.0/24
✑ Managed disks: No
✑ Location: East US
You need to record all the successful and failed connection attempts to VM1.
Which three actions should you perform? Each correct answer presents part of the solution.
NOTE: Each correct selection is worth one point.
  1. Enable Azure Network Watcher in the East US Azure region. Correct Answer
  2. Add an Azure Network Watcher connection monitor.
  3. Register the MicrosoftLogAnalytics provider.
  4. Create an Azure Storage account. Correct Answer
  5. Register the Microsoft.Insights resource provider. Correct Answer
  6. Enable Azure Network Watcher flow logs.

Key Takeaways

The question tests the distinction between active monitoring (Connection Monitor) and passive traffic logging (NSG Flow Logs), requiring knowledge of the underlying infrastructure dependencies for flow logs.

Learn how to record successful and failed connections to an Azure VM using NSG Flow Logs. The correct steps involve enabling Network Watcher, creating a storage account, and registering the Microsoft.Insights provider.

Common mistake: Many candidates choose Option B (Connection Monitor) because they confuse active health checks with passive traffic logging. Connection Monitor does not record existing connection attempts; it only tests reachability at set intervals.

Expert Analysis

The requirement is to record all successful and failed connection attempts to VM1. This specific capability is provided by NSG Flow Logs, which capture IP traffic flowing through a Network Security Group (NSG). To implement this solution, three prerequisites must be met in the correct order.

First, you must ensure the monitoring service itself is active. Although Network Watcher can be automatically enabled in a region when a virtual network is created, exam scenarios often require explicit confirmation or manual enabling of Azure Network Watcher in the target region (East US) to guarantee the diagnostic infrastructure is available. This corresponds to option A.

Second, NSG Flow Logs export their data to an Azure Storage account for persistence and analysis. Therefore, you must create a dedicated Azure Storage account to serve as the destination for these logs. Without a storage account, the flow logs have nowhere to be written. This corresponds to option D.

Third, to enable the logging feature on the NSG associated with VM1, you must use the Microsoft.Insights resource provider. While some providers are pre-registered, Microsoft.Insights often needs to be explicitly registered via PowerShell or CLI to allow Network Watcher to write diagnostic data and manage flow log configurations. This corresponds to option E.

Option B (Connection Monitor) is incorrect because it performs active synthetic tests (ping/TCP checks) at intervals rather than recording actual user traffic flows. Options C and F are either redundant or incorrect; the Log Analytics provider is not required for basic NSG flow logs (which go to Storage), and enabling flow logs (F) is the final step that depends on having the storage account and insights provider ready.

Official Reference

https://learn.microsoft.com/en-us/azure/network-watcher/network-watcher-create

This link opens the official vendor documentation in a new tab.

Exam Strategy

When asked to 'record' or 'log' traffic, immediately think of NSG Flow Logs pointing to a Storage Account. Do not confuse this with Connection Monitor (active testing) or Application Gateway (HTTP logging). Always check if the necessary resource providers (like Microsoft.Insights) and destinations (Storage) are part of the solution options.

Frequently Asked Questions

Does Network Watcher need to be manually enabled?

Network Watcher is often auto-enabled when a VNet is created, but exams may require you to select 'Enable Network Watcher' to ensure the service is active in the specific region before configuring diagnostics.

Why isn't Microsoft.LogAnalytics needed?

NSG Flow Logs primarily export data to Azure Storage accounts. While they can be sent to Log Analytics later, the immediate prerequisite for enabling flow logs is a Storage account and the Microsoft.Insights provider.

More AZ-104 FAQ →

Community Votes

F
33%
E
26%
A
23%
D
14%
B
4%

33% of anonymous learners picked answer F. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 93 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 30 of 93

  1. HenriKI2 👍 83
    https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-monitoring-overview When you create or update a virtual network in your subscription, Network Watcher will be enabled automatically in your Virtual Network's region. There is no impact to your resources or associated charge for automatically enabling Network Watcher. For more information, see Network Watcher create. https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-portal Create a VM with a network security group Enable Network Watcher (done by default with the vnet/subnet creation) -- and register the Microsoft.Insights provider ---------todo Enable a traffic flow log for an NSG, using Network Watcher's NSG flow log capability --todo BUT ! NSG flow log data is written to an Azure Storage account. Complete the following steps to create a storage account for the log data. So you need to create a storage account before enable the NSG flow Download logged data View logged data
  2. jackAttew_1 👍 36
    Answer is correct so AEF. 1.Create a VM with a network security group 2.Enable Network Watcher and register the Microsoft.Insights provider 3.Enable a traffic flow log for an NSG, using Network Watcher's NSG flow log capability 4.Download logged data 5.View logged data https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-portal
  3. Armina 👍 13
    A. Enable Azure Network Watcher in the East US Azure region. E. Register the Microsoft.Insights resource provider. F. Enable Azure Network Watcher flow logs. Explanations: Using a Network Security Group (NSG), you can filter incoming traffic to and outgoing traffic from a virtual machine. You can log the network traffic that runs through an NSG using Network Watcher's NSG flow protocol feature. We must enable Network Watcher in the region that contains the VM, register the Microsoft.Insights provider, and enable the data flow protocol for the NSG using the Network Watcher feature for NSG flow protocols. Info: Enabling NSG flow logs requires a storage account that can be created as part of activation. Alternatively, the existing storage account that contains the VM1 hard disk can be used. Since "Managed Disk: No" a storage account must already exist. Ref: https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-portal
  4. Marz 👍 11
    It is mentioned that a VM is already created. You cannot create a VM when there is nog VNET. So my conclusion is that the VNET is there, and so Network Watcher already enabled. leaves DEF for answer.
  5. clg003 👍 8
    "By default, Network Watcher is automatically enabled." The only reason you would have to enable it is if you had disabled it. So A is not the answer. The question states you need to record the data and since there are no disks on the VM you must create storage. Network security group flow logging is a feature of Azure Network Watcher that allows you to log information about IP traffic flowing through a network security group. First step of flow logging is registering insights. Register-AzResourceProvider -ProviderNamespace 'Microsoft.Insights'
Show 25 more comments
  1. NaoVaz 👍 8
    D) "Create an Azure Storage Account" & E) " Register the Microsoft.Insights resource provider." & F) " Enable Azure Network Watcher flow logs." "NSG flow log data is written to an Azure Storage account. " - https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-portal
  2. 70ec7c1 👍 7
    Although I agree that Network Watcher is enabled automatically when the VM/VNet is created, it is still a requirement, and MS is most likely testing us that we know this. Unless we use a Log Analytics Workspace for advanced querying and visualizing of the NSG Flow logs, we really do not need to register Microsoft.Insights Provider. The simple solution is to store in a storage account. So, Enable NSG Flow Logs is the critical. We need to save the logs somewhere. The options would be a storage account or Log Analytics Workspace (for advanced queries). Only storage account is an available option. Finally, if we just use storage accounts, registering Microsoft.Insights is not necessary. In that case, I would go for Enable Azure Network Watcher as the final choice.
  3. EmnCours 👍 7
    Correct Answer: AEF 🗳️ You can log network traffic that flows through an NSG with Network Watcher's NSG flow log capability. ✑ In the Azure portal, enable Network Watcher ✑ Register Insights provider. NSG flow logging requires the Microsoft.Insights provider. ✑ Enable NSG flow log. NSG flow log data is written to an Azure Storage account, Subscription1 has storage. Reference: https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-portal
  4. AzMonkey 👍 7
    Notice the “Managed disks: no”. This means there must already be a storage account for the disks of VM1. So D is not mandatory therefore AEF is correct.
  5. Snownoodles 👍 6
    Correct Answer: DEF "When you create or update a virtual network in your subscription, Network Watcher will be enabled automatically in your Virtual Network's region" https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-monitoring-overview
  6. BowSec 👍 6
    AEF is correct https://www.linkedin.com/learning/exam-tips-azure-administrator-az-104/monitor-virtual-networking?autoSkip=true&autoplay=true&resume=false&u=78730170
  7. Exilic 👍 5
    The three actions that should be performed to record all the successful and failed connection attempts to VM1 are: A. Enable Azure Network Watcher in the East US Azure region. B. Add an Azure Network Watcher connection monitor. F. Enable Azure Network Watcher flow logs. Explanation: A. Azure Network Watcher is a network monitoring and diagnostic service that provides tools to monitor, diagnose, and gain insights into your network performance and health. By enabling Azure Network Watcher in the East US Azure region, you can monitor the traffic to and from VM1. B. Adding an Azure Network Watcher connection monitor allows you to monitor the connectivity and latency between VM1 and a target IP address or FQDN. This will enable you to track all the successful and failed connection attempts to VM1. F. Enabling Azure Network Watcher flow logs will allow you to capture information about the IP traffic to and from VM1. This information can be stored in a storage account or sent to a Log Analytics workspace for analysis and reporting. The other options are not required for recording the successful and failed connection attempts to VM1. Therefore, the correct answer is A, B, and F.
  8. kklohit 👍 5
    To record all the successful and failed connection attempts to VM1, you need to: A. Enable Azure Network Watcher in the East US Azure region. B. Add an Azure Network Watcher connection monitor. F. Enable Azure Network Watcher flow logs. Registering the MicrosoftLogAnalytics provider (C) is not necessary for this specific requirement, and creating an Azure Storage account (D) is not mentioned as a requirement. Registering the Microsoft.Insights resource provider (E) is also not needed for this specific scenario.
  9. MatAlves 👍 5
    Answer = EDF (in this order) Full list of steps: 1. Create a virtual network = already exist (can't create VM without it) 2. Create a virtual machine with a network security group associated to its network interface (already exist) 3. Register Microsoft.insights provider 5. Create a storage account 6. Enable flow logging for a network security group using Network Watcher flow logs 7. Download logged data 8. View logged data https://learn.microsoft.com/en-us/azure/network-watcher/nsg-flow-logs-tutorial
  10. LuchianoTz 👍 5
    A,E & F To have all the logs 1.Enable Network watcher for the particular region 2.Register insight provider 3.Create a storage account 4.Enable NSG flow logs Step #3 is not in the answer as the subscription already has the storage account
  11. Ken88 👍 5
    AEF is correct. You already have the Storage included in the subscription. There is no need to create a storage account.
  12. ajdann 👍 5
    I highly recommend not to use chat gpt to answer these questions
  13. _punky_ 👍 5
    Checked! This ans is correct.
  14. yeanlingmedal71 👍 5
    D, E, F - options are changed
  15. Mozbius_ 👍 4
    Answer is definitely AEF but DEF technically can easily be argued as a good answer too since Network Watcher gets automatically enabled for the region where a virtual network is created or updated in a subscription and creating a storage account is also required. https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-monitoring-overview#:~:text=Network%20Watcher%20is%20designed%20to%20monitor%20and%20repair,not%20work%20for%20PaaS%20monitoring%20or%20Web%20analytics. That being said I believe Microsoft is looking here for a specific scenario that it has well established which is in fact taking in consideration the possibility that (A) [Enabling Network Watched] may have already been taken cared of BUT it still puts (A) as the first step following the creation of a VM (Network Watcher could by some fluke be disabled I guess). Hence why AEF is really the answer that Microsoft is looking for. https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-portal
  16. er101q 👍 4
    The three essential steps to record all the successful and failed connection attempts to VM1 are: E. Register the Microsoft.Insights resource provider A. Enable Azure Network Watcher in the East US Azure region F. Enable Azure Network Watcher flow logs These three steps are required to enable the functionality to monitor and log network traffic to VM1. Additionally, creating an Azure Storage account is recommended as it is where the flow logs will be stored.
  17. cryptotafkar 👍 4
    Typical M$. Very tricky! EF are correct, but ... between A and D ??? A - is correct if the administrator opt-out of the auto watcher creator process - https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-create D- When you enable flow log, you need to choose or create a storage account. So, it's 50/50 :-)... my guts says A, because D will be included, while enabling the flow data.
  18. BShelat 👍 4
    A, D, E, F are required steps. VM1 does not have managed disks i.e. it has it has it sown disk i.e. storage account already exists. So "D" is not required, we can select existing storage account and hence answer is A, E and F.
  19. RandomNickname 👍 4
    Provided I understand correctly D,E,F and as per URL look correct for VM network traffic; https://learn.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-portal
  20. holytoni 👍 4
    I think its AEF. As the machine has an unmanaged disk, therefore a storage account should already be there.
  21. Penguinyo 👍 4
    Nothing called Azure Network Watcher flow logs. It should be Azure Network Watcher NSG flow logs.
  22. yangxs 👍 4
    Network watcher is automatically created. so no need to do A.
  23. olsenOnS 👍 4
    In my opinion its correct
  24. Exilic 👍 3
    ChatGPT response: The three actions that should be performed to record all the successful and failed connection attempts to VM1 are: A. Enable Azure Network Watcher in the East US Azure region. B. Add an Azure Network Watcher connection monitor. F. Enable Azure Network Watcher flow logs. Explanation: A. Azure Network Watcher is a network monitoring and diagnostic service that provides tools to monitor, diagnose, and gain insights into your network performance and health. By enabling Azure Network Watcher in the East US Azure region, you can monitor the traffic to and from VM1. B. Adding an Azure Network Watcher connection monitor allows you to monitor the connectivity and latency between VM1 and a target IP address or FQDN. This will enable you to track all the successful and failed connection attempts to VM1. F. Enabling Azure Network Watcher flow logs will allow you to capture information about the IP traffic to and from VM1. This information can be stored in a storage account or sent to a Log Analytics workspace for analysis and reporting. The other options are not required for recording the successful and failed connection attempts to VM1. Therefore, the correct answer is A, B, and F.
  25. Mehedi007 👍 3
    "By default, Network Watcher is automatically enabled. When you create or update a virtual network in your subscription, Network Watcher will be automatically enabled in your Virtual Network's region." https://learn.microsoft.com/en-us/azure/network-watcher/network-watcher-create?tabs=portal https://learn.microsoft.com/en-us/azure/network-watcher/nsg-flow-logging According to these, the workflow should be: {Enable Network Watcher for your region (should be enabled already when the Vnet was created) > register Microsoft.Insights provider > create Azure storage account (should be there already for managed disks) > Create a flow log > enable traffic analytics & LA workspace.} So, here I'd choose from the given choices E>D>F Register Microsoft.Insights provider > create Azure storage account (unmanaged disks) > Create a flow log

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Practice All AZ-104 Questions

Access 100 questions with complete answers and detailed explanations.

View Full AZ-104 Practice Test →

← Back to AZ-104 Study Guide