Optimizing Virtual Machine Security and Performance Using NSG and ASG on Azure

Problem Statement

A mid-sized enterprise migrated its internal business application and customer portal to Microsoft Azure Virtual Machines.

The system supports approximately 2000 daily users, including employees and external customers. While the infrastructure was successfully deployed, the organization began experiencing:

The infrastructure team relied primarily on basic networking configurations and assumed: Cloud infrastructure is secure by default.

This assumption led to architectural gaps.

The objective was to optimize Virtual Machines using proper network segmentation and security controls through Network Security Groups (NSG) and Application Security Groups (ASG).

Existing Azure Architecture

The application was deployed using:

All VMs were deployed into a flat network structure with limited segmentation.

Incident Summary

During a quarterly security review and internal load spike:

Although there was no full outage, the architecture was:

Business Impact

The organization recognized that performance optimization is directly tied to network security and architecture design.

Root Cause Analysis

1. What Was the Core Issue?

Layer Problem Identified
Network Flat subnet architecture
Security Broad NSG rules allowing wide IP ranges
Management IP-based rule configuration
Scalability Manual rule updates for each new VM
Exposure Database VM had unnecessary inbound access

2. Why Did It Happen?

Optimization Strategy Using NSG and ASG

Step 1: Network Segmentation

The single subnet architecture was redesigned into:

Each subnet was associated with a dedicated NSG.

This reduced lateral movement risk inside the network.

Step 2: Introduce Application Security Groups (ASG)

Three ASGs were created:

Each VM was assigned to its respective ASG based on its role. This eliminated the need to define rules using IP addresses.

Step 3: Implement Least-Privilege NSG Rules

Priority Source Destination Port Action
100 Internet Web-ASG 443 Allow
110 Web-ASG App-ASG 8080 Allow
120 App-ASG DB-ASG 1433 Allow
200 Any Any Any Deny

Additional Controls:

Traffic flow became structured and predictable.

Performance Optimization Achieved

Before Optimization

After Optimization

Estimated improvements:

Why NSG and ASG Are Important for VM Optimization

1. Security-Driven Performance

Blocking unwanted traffic at the network layer reduces:

Security controls indirectly improve VM efficiency.

2. Logical Architecture Design

ASGs allow role-based grouping instead of IP-based mapping.

Benefits:

3. Scalability Without Complexity

When new Web VMs are deployed:

This supports rapid scaling without increasing operational risk.

4. Compliance and Audit Readiness

With structured NSG rules:

Observability and Monitoring Enhancements

After optimization:

This improved visibility into network behavior.


Key Lessons Learned

Conclusion

This case demonstrates how Azure Virtual Machine environments can become vulnerable and inefficient without proper network segmentation.

By implementing:

The organization achieved:

NSG and ASG are not just security features — they are foundational components for building scalable, efficient, and production-ready Azure Virtual Machine architectures.

💬
AI Learning Assistant