Azure Monitor for Networks
Complete the full lesson to earn 25 points — 50 with Pro
Work through each section, then tap “Mark as Complete” on the last one.
✦ Skip the page breaks, the wait, and see fewer ads — read each lesson on a single page with Pro
Module: Secure and Monitor Networks
Lesson: Azure Monitor for Networks
Introduction: Why Network Observability Matters
In modern cloud environments, the network is the invisible backbone that connects your applications, databases, and users. When a network issue occurs, it is rarely isolated; it often manifests as a slow application, a database connection timeout, or an inability for a microservice to reach its dependency. Without deep visibility into how traffic flows across your virtual networks, you are essentially flying blind. Azure Monitor for Networks is the comprehensive suite of tools provided by Microsoft to bridge this visibility gap, offering a centralized view of your network infrastructure's health, performance, and security posture.
Understanding this topic is critical because cloud networks are dynamic. Unlike traditional on-premises environments where hardware is static and physical paths are fixed, cloud networks involve software-defined networking (SDN) components like Virtual Networks (VNets), Load Balancers, Application Gateways, and ExpressRoute circuits. These components can be modified, scaled, or replaced in seconds. Azure Monitor for Networks allows you to track these changes, visualize traffic patterns, and receive alerts when anomalous behavior suggests a bottleneck or a security breach. By mastering these tools, you transition from reactive troubleshooting—where you fix things after users complain—to proactive management, where you identify and resolve issues before they impact the business.
The Core Components of Azure Monitor for Networks
Azure Monitor for Networks is not a single tool, but rather a collection of integrated services that pull data from various points in your network topology. To effectively manage your environment, you need to understand the distinct roles these components play.
- Azure Network Watcher: This is the primary diagnostic and visualization service. It allows you to monitor, diagnose, view metrics, and enable or disable logs for resources in an Azure virtual network.
- Azure Monitor Metrics: This service collects numeric data from your network resources at regular intervals. It is ideal for alerting on specific thresholds, such as high CPU usage on a virtual appliance or increased latency on a VPN gateway.
- Azure Monitor Logs (Log Analytics): This is where detailed telemetry, such as Flow Logs and Diagnostic Logs, is stored. By using Kusto Query Language (KQL), you can perform deep-dive forensics on traffic patterns and security events.
- Connection Monitor: A feature within Network Watcher that provides end-to-end connectivity monitoring between endpoints (VMs, FQDNs, URIs, or IPv4 addresses). It acts as a synthetic agent, constantly testing the path between your assets.
Callout: Metrics vs. Logs It is important to distinguish between these two data types. Metrics are quantitative data points—numbers that change over time—such as "packets dropped per second." They are excellent for real-time alerting and dashboarding. Logs are qualitative, descriptive records of events, such as "Source IP 10.0.0.4 accessed Destination IP 10.0.0.5 on Port 443." Logs are essential for troubleshooting, forensic analysis, and auditing compliance.
Deep Dive: Network Watcher Features
Network Watcher is the "Swiss Army knife" of Azure networking. It includes several specialized tools that serve different diagnostic purposes.
1. IP Flow Verify
This tool allows you to check if a packet is allowed or denied to or from a virtual machine based on the effective security rules. If you have ever spent hours debugging a complex Network Security Group (NSG) rule set, you know how difficult it can be to trace the logic. IP Flow Verify simulates the traffic flow and tells you exactly which security rule permitted or blocked the connection, allowing you to iterate on your rules without guessing.
2. Next Hop
When you have complex routing tables, especially with virtual appliances or User Defined Routes (UDRs), it can be hard to tell where a packet is actually going. Next Hop tells you the next destination for a packet from a specific VM. This is invaluable when you are implementing a "hub-and-spoke" network topology where traffic must pass through a firewall before reaching its destination.
3. NSG Flow Logs
Flow logs capture information about IP traffic flowing through your NSGs. This data is written to an Azure Storage account and can be ingested into Log Analytics. This is a critical feature for security teams, as it provides a trail of every conversation happening inside your network. You can see which internal resources are talking to the internet and which are communicating internally, helping you identify lateral movement or data exfiltration attempts.
Implementing Connection Monitor
Connection Monitor is perhaps the most practical tool for a network engineer. Instead of waiting for a user to report that a service is down, you configure a connection monitor to probe the service continuously.
Step-by-Step: Setting up a Connection Monitor
- Navigate to Network Watcher: In the Azure Portal, search for "Network Watcher" and select it.
- Select Connection Monitor: Under the "Monitoring" section in the left-hand menu, click "Connection Monitor."
- Create a Monitor: Click "Create" to start the wizard. You will need to define a test group.
- Define Endpoints: Choose your source (e.g., a Virtual Machine) and your destination (e.g., an external website or another private IP address).
- Configure Test Configuration: Select the protocol (TCP, ICMP, or HTTP/S) and the port. You can also set the frequency of the test (e.g., every 60 seconds).
- Create and Review: Once deployed, the monitor will immediately begin collecting data. You can view the results in the "Monitor" tab, which displays a visual map of the path, including latency and packet loss at each hop.
Note: When using Connection Monitor, ensure that your Network Security Groups allow the necessary probes. For TCP-based tests, the target must be listening on the specified port, or the test will report a failure even if the network path is otherwise healthy.
Leveraging Kusto Query Language (KQL) for Network Insights
Once you have enabled diagnostic logging, your data will be stored in a Log Analytics Workspace. To make sense of this data, you must become proficient in KQL. This language is designed for high-performance log analysis and is the backbone of Azure Monitor.
Example: Querying NSG Flow Logs
If you want to find all traffic that was denied by an NSG, you would use a query similar to the following:
AzureNetworkAnalytics_CL
| where FlowStatus_s == "D"
| summarize Count = count() by SrcIP_s, DestIP_s, DestPort_d
| sort by Count desc
Explanation of the query:
AzureNetworkAnalytics_CL: This is the table where flow log data is stored.where FlowStatus_s == "D": This filters the results to show only denied flows.summarize Count = count() by ...: This groups the results by source, destination, and port, then counts how many times each unique combination occurred.sort by Count desc: This displays the most frequent denials at the top, allowing you to identify potential brute-force attacks or misconfigured services quickly.
Network Performance Monitor (NPM) and Beyond
While Connection Monitor is the modern standard, many legacy environments still use Network Performance Monitor (NPM). NPM provides visibility into the performance of hybrid network environments, specifically focusing on connectivity to on-premises sites via ExpressRoute or VPN.
When monitoring ExpressRoute, you should track:
- Circuit Availability: Is the circuit up or down?
- Packet Loss: Is the circuit experiencing congestion?
- Latency: Are there delays in the round-trip time between your on-premises data center and the Azure region?
By setting up alerts on these metrics, you can ensure that your hybrid connectivity remains stable and performant. If you notice a spike in latency, it might indicate that your ISP is routing traffic through a suboptimal path or that there is congestion at the peering point.
Best Practices for Network Monitoring
Monitoring is not a "set it and forget it" task. It requires a disciplined approach to ensure that the data you collect is relevant, actionable, and cost-effective.
- Enable Diagnostics Everywhere: Always enable diagnostic logs for your critical network resources, including Load Balancers, Application Gateways, and ExpressRoute circuits. If you don't enable them, you cannot troubleshoot issues that occur after the fact.
- Use Resource Groups for Organization: Organize your monitoring alerts and dashboards by resource group or application context. This makes it easier to identify which team is responsible for a specific network component when an alert fires.
- Implement "Alert Fatigue" Prevention: Do not alert on every minor fluctuation. Set thresholds that reflect actual business impact. For example, a 1% packet loss for 30 seconds might be noise, but 5% packet loss for 5 minutes is a genuine issue requiring attention.
- Automate Remediation: Where possible, use Azure Logic Apps to trigger automated responses to specific alerts. For example, if a specific IP is flagged for excessive denied connections, a Logic App could automatically update an NSG rule to block that IP at the edge.
- Regularly Audit Your Logs: Periodically review your Flow Logs to identify unused rules or unexpected traffic patterns. This is a vital part of maintaining a secure network perimeter.
Callout: The Cost of Monitoring Log Analytics and Network Watcher incur costs based on the volume of data ingested and the number of tests performed. It is vital to monitor your ingestion rates to avoid unexpected monthly bills. Use the "Usage and estimated costs" blade in your Log Analytics workspace to keep an eye on your consumption and consider setting daily data caps if necessary.
Common Pitfalls and How to Avoid Them
Even with the best tools, it is easy to fall into traps that lead to incomplete data or misleading conclusions.
- The "Silent" NSG Rule: Many engineers forget that NSG rules are processed in priority order. If you have a broad "Allow" rule at a high priority, you might accidentally permit traffic that you intended to block with a more specific rule later in the list. Always use IP Flow Verify to test your rules after every change.
- Insufficient Logging Retention: The default retention period for some log types may be too short for forensic analysis or compliance requirements. Ensure that you configure your Log Analytics workspace to retain data for a period that aligns with your organization's security policies (e.g., 90 days, 180 days, or a year).
- Ignoring User-Defined Routes (UDRs): When traffic doesn't reach its destination, the first instinct is to check NSGs. However, if you have a UDR that directs traffic to a non-existent virtual appliance, the traffic will simply be dropped. Always use the "Next Hop" tool to verify the routing path.
- Over-reliance on Default Metrics: Default metrics are useful, but they don't tell the whole story. Custom metrics and log queries provide the granularity needed for complex application troubleshooting. Don't be afraid to create custom dashboards that combine data from multiple sources.
Comparison: Azure Monitor Tools for Networking
| Feature | Primary Use Case | Data Type | Best For |
|---|---|---|---|
| IP Flow Verify | Troubleshooting connectivity | Diagnostic | Immediate validation of security rules |
| Next Hop | Troubleshooting routing | Diagnostic | Verifying complex UDR/Appliance paths |
| Connection Monitor | Continuous health check | Metrics | Detecting latency/loss between endpoints |
| NSG Flow Logs | Security auditing | Logs | Forensic analysis and traffic pattern review |
| Azure Monitor Metrics | Resource health | Metrics | Real-time alerting on thresholds |
Real-World Scenario: Troubleshooting a Slow Web Application
Imagine you are managing a web application behind an Azure Application Gateway. Users are reporting intermittent slowness. How do you use the tools discussed to find the root cause?
- Step 1: Metric Check. You start by looking at the Application Gateway metrics in Azure Monitor. You notice that the "Request Count" is normal, but the "Backend Connect Time" has spiked. This tells you the issue is between the Gateway and the backend servers, not the client and the Gateway.
- Step 2: Connection Monitor. You check the Connection Monitor you set up between the Application Gateway subnet and the backend VM subnet. You see that latency is high, but only for certain instances.
- Step 3: IP Flow Verify. You suspect a misconfigured NSG rule might be causing traffic to be routed inefficiently or throttled. You run IP Flow Verify from the Gateway subnet to the backend VM IP. It confirms that traffic is allowed, but the path is traversing a network virtual appliance that is currently under heavy load.
- Step 4: Log Analysis. You query the NSG Flow Logs for the virtual appliance. You see a massive spike in traffic from a specific internal source. You identify the source, throttle it, and the latency on the Application Gateway immediately returns to normal.
This scenario illustrates how the tools work together in a diagnostic workflow. You start broad with metrics, narrow down with connectivity tests, and finally perform a deep dive with logs to find the root cause.
Advanced Configuration: Integrating with Security Center
Azure Monitor for Networks integrates closely with Microsoft Defender for Cloud (formerly Azure Security Center). When you enable Network Watcher, Defender for Cloud can ingest your flow logs to provide "Adaptive Network Hardening" recommendations.
This feature analyzes your actual traffic patterns and suggests NSG rules that follow the principle of least privilege. For example, if your server only receives traffic on port 443 from a specific set of IPs, Defender will recommend that you close all other ports and restrict access to only those known IPs. Implementing these recommendations is a highly effective way to shrink your attack surface without manually auditing every single rule.
Security and Compliance Considerations
When monitoring your network, you are essentially creating a map of your entire infrastructure. This data is sensitive. Ensure that you apply the following security measures:
- Role-Based Access Control (RBAC): Limit who can view network logs and diagnostic settings. Use "Reader" roles for analysts and "Contributor" roles only for those who need to modify network configurations.
- Log Integrity: Ensure that your storage accounts and Log Analytics workspaces are protected. Use Azure Policy to enforce that all diagnostic logs are sent to a centralized, locked-down workspace.
- Data Residency: Depending on your jurisdiction, you may have requirements regarding where your logs are stored. Ensure that your Log Analytics workspace is located in a region that complies with your organizational data sovereignty needs.
Future-Proofing Your Network Monitoring Strategy
As cloud environments grow, manual monitoring becomes impossible. You must move toward "Monitoring as Code." This involves defining your diagnostic settings, alerts, and dashboards using infrastructure-as-code tools like Terraform or Bicep.
By treating your monitoring configuration as code, you ensure that every new virtual network or application you deploy is automatically monitored from day one. This consistency is the hallmark of a mature cloud operations team. If you deploy a new VNet and forget to enable Flow Logs, you have a blind spot. If you automate the deployment of that VNet, you can include the diagnostic configuration in the same template, ensuring that the blind spot never exists.
Key Takeaways
- Observability is Proactive: Azure Monitor for Networks transforms your approach from reactive troubleshooting to proactive management by providing real-time visibility into traffic and health.
- Choose the Right Tool: Understand the difference between metrics (quantitative, real-time alerts) and logs (qualitative, forensic analysis) to select the right tool for the job.
- Master the Diagnostic Suite: Network Watcher tools like IP Flow Verify and Next Hop are essential for debugging the complexities of software-defined networking, where standard ping tests often fail to provide the full picture.
- Automate and Standardize: Use infrastructure-as-code to ensure that every network resource you deploy is automatically configured for logging and monitoring, preventing configuration drift and blind spots.
- Focus on Actionable Alerts: Avoid alert fatigue by setting thresholds that focus on business-impacting events rather than minor fluctuations, and leverage automation to handle routine remediation tasks.
- Security and Monitoring are One: Use network logs to feed into security tools like Microsoft Defender for Cloud to gain insights into potential threats and receive recommendations for hardening your network perimeter.
- Continuous Improvement: Network monitoring is an iterative process. Regularly review your logs, refine your alert thresholds, and update your rules to match the evolving needs of your applications.
By integrating these strategies into your daily workflow, you will build a resilient, secure, and highly performant network environment capable of supporting even the most demanding enterprise applications. Remember that the network is the heart of your cloud presence; keeping it visible and monitored is the best way to ensure the long-term success and reliability of your digital infrastructure.
Reach the last section to complete this lesson and earn points — you're on section 1 of 10.
- Introduction to Azure Networking
- Introduction to Azure Networking Quiz5q
- Virtual Network Address Spaces
- Virtual Network Address Spaces Quiz5q
- Subnet Design and Configuration
- Subnet Design and Configuration Quiz5q
- Public and Private IP Addressing
- Public and Private IP Addressing Quiz5q
- Network Interface Configuration
- Network Interface Configuration Quiz5q
- Azure DNS Configuration
- Azure DNS Configuration Quiz5q
- Virtual Network Peering
- Virtual Network Peering Quiz5q
- Global VNet Peering
- Global VNet Peering Quiz5q
- Azure Virtual WAN
- Azure Virtual WAN Quiz5q
- Virtual WAN Hub Configuration
- Virtual WAN Hub Configuration Quiz5q
- Service Chaining and UDR
- Service Chaining and UDR Quiz5q
- Network Virtual Appliances
- Network Virtual Appliances Quiz5q
- Azure VPN Gateway Overview
- Azure VPN Gateway Overview Quiz5q
- Site-to-Site VPN Configuration
- Site-to-Site VPN Configuration Quiz5q
- Point-to-Site VPN Configuration
- Point-to-Site VPN Configuration Quiz5q
- VPN Gateway SKUs and Sizing
- VPN Gateway SKUs and Sizing Quiz5q
- VPN Gateway High Availability
- VPN Gateway High Availability Quiz5q
- VPN Gateway Troubleshooting
- VPN Gateway Troubleshooting Quiz5q
- ExpressRoute Overview
- ExpressRoute Overview Quiz5q
- ExpressRoute Circuit Configuration
- ExpressRoute Circuit Configuration Quiz5q
- ExpressRoute Peering Types
- ExpressRoute Peering Types Quiz5q
- ExpressRoute Global Reach
- ExpressRoute Global Reach Quiz5q
- ExpressRoute FastPath
- ExpressRoute FastPath Quiz5q
- ExpressRoute High Availability
- ExpressRoute High Availability Quiz5q
- Azure Load Balancer Overview
- Azure Load Balancer Overview Quiz5q
- Internal Load Balancer Configuration
- Internal Load Balancer Configuration Quiz5q
- Public Load Balancer Configuration
- Public Load Balancer Configuration Quiz5q
- Load Balancer Health Probes
- Load Balancer Health Probes Quiz5q
- Cross-Region Load Balancer
- Cross-Region Load Balancer Quiz5q
- Application Gateway Overview
- Application Gateway Overview Quiz5q
- Application Gateway Components
- Application Gateway Components Quiz5q
- URL Path-Based Routing
- URL Path-Based Routing Quiz5q
- Multi-Site Hosting
- Multi-Site Hosting Quiz5q
- SSL Termination and End-to-End SSL
- SSL Termination and End-to-End SSL Quiz5q
- Web Application Firewall Integration
- Web Application Firewall Integration Quiz5q
Enjoying the courses?
Everything stays free. Pro shows fewer ads, doubles the points you earn on every lesson and quiz so you progress twice as fast, unlocks half of every practice exam — plus full case studies — with the Learn & Exam study modes, and lets you read each lesson on one page.
- ✓ Fewer advertisements
- ✓ 2× points per lesson & quiz
- ✓ 50% of every exam unlocked
- ✓ Learn & Exam modes
- ✓ Distraction-free lessons