Microsoft AZ-104: NSGs, ASGs, and Azure Firewall
Azure network security is easier to reason about when the packet path is clear. NSGs filter subnet and interface traffic, ASGs describe VM application groups, and Azure Firewall supplies central inspection and policy at designed routing boundaries. An NSG, application security group, and Azure Firewall solve related but distinct policy problems. The administrator must know where traffic is evaluated, which identity or address group the rule represents, and which logs can prove the intended decision occurred.
On this page
- Follow the traffic before choosing a control
- Use NSGs for local packet-filtering boundaries
- ASGs describe application membership within NSG rules
- Azure Firewall provides centralized traffic control
- Decide where each policy should live
- Diagnose a denied connection without weakening everything
- Translate requirements into testable change records
Follow the traffic before choosing a control
A connection failure in Azure can be caused by DNS, routing, a network security group, a guest firewall, a private endpoint policy, or an application that is not listening. Adding another allow rule is rarely the best first response. Before deciding whether an NSG, an application security group or Azure Firewall should change, identify the actual source IP, destination IP, protocol, port and next hop. Packet-path evidence should drive Microsoft AZ-104 network-security decisions before an administrator changes an NSG, application security group or Azure Firewall rule.
Picture two application tiers: a public-facing web service and private application VMs that connect to a database. The intended rule might allow HTTPS into the web tier, permit a narrow backend port from the web tier to application servers, and block unrelated lateral movement. Such a policy needs both connectivity and boundaries. Writing “web may call app” is a useful starting point, but the network design must still translate that intent into effective rules, routes and testable flows.
A diagnostic approach like VNet and DNS troubleshooting provides the evidence needed before changing security. An NSG rule cannot make traffic reach the correct subnet if the route leads elsewhere. Azure Firewall inspection cannot correct a private DNS name that resolves to the wrong endpoint. Work through the packet path in order rather than treating security rules as universal connectivity repair.
Use NSGs for local packet-filtering boundaries
A network security group contains inbound and outbound rules evaluated using protocol, ports, addresses and priorities. It can be associated with supported subnets and network interfaces. Each rule expresses allow or deny behavior at that boundary, and Azure supplies default rules that must be considered alongside custom rules.
NSG rule priority runs from lower numeric values to higher ones, as documented for network security group rules. A broad allow evaluated earlier can shadow a narrower deny, even when the administrator assumes that the deny will override it. A subnet NSG can also reject a flow that interface-level rules would allow. Compare effective security rules for the actual source, destination, protocol and port before changing a policy.
NSGs are stateful for established flows. They do not require symmetric hand-written return rules for every allowed conversation, but new flows and direction still matter. After changing a rule, validate a newly initiated test connection and examine the applicable effective rules and flow evidence. Do not confuse a previously established session with proof that new inbound connections are allowed under the new policy.
ASGs describe application membership within NSG rules
Application security groups make rules easier to maintain when multiple VMs serve the same function. Instead of copying individual private IP addresses into every rule, an administrator can refer to a group of supported VM network interfaces, such as an application tier. This can support repeatable policy when VM addresses change or the tier is scaled.
An ASG is not itself a firewall, an identity group or a routing table. It works as a source or destination selector in suitable NSG rules. Membership and networking constraints must be checked against the supported configuration. A rule such as “application-tier to database-tier on the necessary port” can be clearer than one that embeds a set of IPs whose owners are unknown.
Overusing ASGs can create a different maintenance problem. If one group contains unrelated systems because they share a team name, the policy loses its meaning. Assign members by real traffic role, review exceptions explicitly and verify that scaling actions put new interfaces into the expected group. The rule model should help an incident responder understand the architecture without requiring them to reverse-engineer naming conventions.
Azure Firewall provides centralized traffic control
Azure Firewall is a managed security service that can enforce central network and application rules for traffic deliberately routed through it. It is commonly used in hub-and-spoke designs for governed ingress, egress or east-west inspection according to architecture and feature support. The critical qualification is routing: deploying a firewall in a hub does not automatically cause every spoke packet to traverse it.
User-defined routes, peering options, next-hop selection and symmetric return paths determine whether the firewall is actually in the forwarding path. A security diagram that shows a shield icon between two networks is not enough. Inspect effective routes from representative source workloads and verify that the intended sessions traverse the firewall. Otherwise a carefully reviewed Firewall Policy can be bypassed unintentionally by an unexamined direct route.
An Azure Firewall deployment evaluates transport and address criteria through network rules, while application rules can apply supported application-layer destination controls. Rule collection ordering, routing and DNS configuration affect which policy a packet encounters. Verify the matching rule and observed traffic rather than borrowing assumptions from another firewall product with a different inspection pipeline.
Decide where each policy should live
An NSG close to a workload provides a useful local boundary: the web subnet accepts only required ingress, and a database subnet rejects arbitrary sources. Central Azure Firewall policy can apply organization-wide egress controls and inspect traffic crossing defined network boundaries. These policies can complement one another instead of being competing products selected by preference.
A useful design question is whether a proposed rule expresses a local application segmentation decision or a central network policy. Allowing only an application tier to reach its database is often a workload-level rule. Restricting all outbound access to approved software update destinations may be a centrally owned policy, provided routes enforce that inspection point. Duplicate controls should be intentional and documented so that diagnosing a block does not become a guessing exercise.
Network owners and application owners need a change contract. Who can add an emergency allow rule? Who verifies that it is removed? How are route changes reviewed alongside firewall policy? A change that opens a local NSG while central inspection still denies the request may be harmless but misleading; a route change that bypasses an intended inspection point may be much worse. Review connectivity and security together.
Diagnose a denied connection without weakening everything
Suppose an Azure VM cannot connect to an internal API on TCP 443. Start with the resolved destination and test the transport attempt from the source. Check the source subnet/interface effective rules, effective route, expected next hop, any intervening firewall logs, and destination-side filtering. Only after locating the rejecting control should the administrator propose the smallest authorized change.
A typical failure sequence might involve a valid DNS record and an NSG allow on the source, but a route toward an NVA whose return path is different. Adding broad outbound and inbound allows does not solve the asymmetric routing. Another case involves a correct route and local rules while Azure Firewall denies the FQDN or port. Its policy evidence points to the actual permitted exception needed, if the business approves it.
Use network tools as supporting observations, not as substitutes for an understood architecture. Flow verification, effective rule views, packet captures and firewall logs can help distinguish whether traffic was seen and rejected. Label hypothetical troubleshooting cases as such, and do not claim an Azure diagnostic run was executed merely because the portal offers the tool.
Translate requirements into testable change records
For each proposed policy, document a legitimate allowed flow and a nearby flow that should remain denied. If a web tier may query a database, test that connection and also confirm that an unrelated VM cannot access the same service. A positive connectivity test alone does not prove least privilege. Record source/destination identity, resolved addresses, port, effective route, applied rule and final outcome.
Changes also need expiration and cleanup rules. Temporary maintenance access can outlive an incident when nobody owns removal. Periodic reviews of broad source ranges, high-priority exceptions and unused application groups are more valuable than simply counting the number of rules. Inspect whether a rule still corresponds to a real service dependency rather than preserving it because no one remembers why it was created.
A useful security review starts with one allowed application flow and one flow that should be rejected. Trace both through effective routes, network security group evaluation, any central firewall, and the workload endpoint. The desired result is not simply fewer firewall rules: legitimate traffic must succeed, denied traffic must stay denied, and an operator must be able to show precisely which control enforced each decision.