ZeroToArchitect Logo

Application Security Groups (ASGs)

ASGs let you group VMs, like web servers or databases, and apply network rules to the group instead of each machine. This makes security simpler, clearer, and easier to scale.

4 min read
2 exam insights

When you manage a large number of Virtual Machines in Azure, setting security rules at the subnet or NIC level can become hard to manage.

Not every VM in a subnet needs the same rules, and manually updating NSG rules whenever a new VM is deployed is time consuming and prone to human error.

In this lesson, you’ll learn how to simplify that by dynamically assigning Network Security Groups (NSGs) to VMs by applying labels to them.

What is an Application Security Group (ASG)?

Example Application Security Groups

An Application Security Group (ASG) is a way to logically group VMs together to simplify network security. In simple terms, it’s a way to “label” VMs and then use those labels to define NSG rules.

For example, suppose you have multiple VMs running web applications. You can create an ASG named WebServers and assign all your web server VMs to it. Similarly, you can create another ASG named Databases and assign your database VMs to that group.

After you define the ASGs, you can define a NSG rule that says “Allow incoming traffic from the WebServers ASG to the Databases ASG on port 1433”

With this approach, you eliminate the need to reference specific IP addresses in your NSG rules. Whenever you will add a new VM to the WebServers ASG, it will automatically inherit the NSG rules attached to that label. This makes it easier to scale and maintain your Virtual Network security.

Exam Insight

Remember that Application Security Groups (ASGs) are applied to Network Interface Cards (NICs), not the Virtual Machine object itself.

Do you still need NSGs if you use ASGs?

ASGs working together with NSGs

Yes. Application Security Groups (ASGs) don’t replace Network Security Groups (NSGs), they actually work together.

An ASG is a way to group VMs logically, while an NSG is what actually enforces network security rules.

You still need NSGs at the subnet or Network Interface Card (NIC) level, just as before.

The difference is that instead of you needing to write rules based on individual IP addresses, you can reference ASGs as the source or destination in the NSG rule. This approach makes it easier to maintain NSG rules as new VMs are added or removed.

For example, consider that you have the following NSG rules defined:

Source

Destination

Protocol

Port

0.0.0.0/0

WebServers (ASG)

HTTP

80

WebServers (ASG)

Databases (ASG)

TCP

1433

The first rule allows inbound HTTP traffic from anywhere (the internet) to any Virtual Machine in the WebServers ASG. Because you referenced an ASG, you no longer need to maintain a list of IP addresses for each VM. Any VM with the label WebServers will have this NSG rule applied.

The second rule allows traffic from the WebServers ASG to the Databases ASG on port 1433. This means that only VMs labeled as WebServers can communicate with VMs labeled a Databases , on port 1433.

As you’ve seen, ASGs don’t replace NSGs, but rather they work together to simplify network security in your Azure environment.

Exam Insight

ASGs work only within the same Virtual Network. When creating an NSG rule, you cannot reference ASGs that are part of different Virtual Networks, even if they are peered.

What to remember for your exam

  • ASGs allow you to group VMs based on their function (such as WebServers, Databases) to simplify network security.

  • ASGs are applied to Network Interface Cards (NICs), not directly to Virtual Machines.

  • ASGs don’t replace Network Security Groups (NSGs), but rather work together. ASGs group VMs, NSGs enforce rules on them.

  • Both the source and destination ASGs must be in the same Virtual Network when used inside an NSG rule.

  • A single Network Interface Card (NIC) can belong to multiple ASGs.

What’s next?

To lock in what you’ve learned, take the short 8-question quiz for this lesson. It will help you test your understanding of Application Security Groups (NSGs) before you move on.

In the next lesson, you will learn how to connect two isolated Virtual Networks together using peering, allowing resources from both networks to communicate with each other.

Alexandru Tepes

Author

Alexandru Tepes

Software Engineer, Tech Educator & Founder. 6x Microsoft + AWS Certified. Helping you go from Zero to Certified Cloud Architect.

Published on 11/17/2025

Practice Quiz

Test your knowledge

*You will be redirected to login first

Want to pass your next certification?

Start practicing with real exam-style questions today. Gain confidence, spot your weak points, and be fully prepared to pass your certification.

Azure AI Engineer certification badge

Azure AI Engineer

Intermediate

For developers creating and deploying AI solutions. Covers computer vision, NLP, knowledge mining, and generative AI, proving skills in integrating AI services within Azure.

13 Practice Exams
Azure Administrator certification badge

Azure Administrator

Intermediate

For IT admins managing Azure infrastructure. Covers identity, storage, networks, and compute resources - essential for administration and operations roles.

12 Practice Exams
Azure Solutions Architect certification badge

Azure Solutions Architect

Expert

For architects designing cloud solutions on Azure. Covers infrastructure, security, data platforms, and business continuity - essential for leading enterprise cloud initiatives.

11 Practice Exams
Azure Fundamentals certification badge

Azure Fundamentals

Beginner

Entry-level certification for beginners in cloud computing. It covers core Azure concepts, services, security, and compliance - ideal for both technical and non-technical roles wanting a foundation in Azure.

10 Practice Exams
Azure Network Engineer certification badge

Azure Network Engineer

Intermediate

For network engineers managing Azure networking. Covers hybrid connectivity, routing, security, and private access to Azure services - critical for enterprise network infrastructure.

12 Practice Exams
Azure Security Engineer certification badge

Azure Security Engineer

Intermediate

For security professionals protecting Azure environments. Covers identity management, platform protection, security operations, and data security - vital for cloud security roles.

11 Practice Exams
Azure AI Fundamentals certification badge

Azure AI Fundamentals

Beginner

Fundamentals certification for understanding AI concepts and building simple solutions with Microsoft Foundry. Covers responsible AI, generative and agentic AI, speech, vision, language, and content understanding.

9 Practice Exams
ML Ops and Gen AI Solutions certification badge

ML Ops and Gen AI Solutions

AdvancedComing Soon

Advanced certification for designing and implementing production AI solutions. Covers RAG architectures, model evaluation, fine-tuning, orchestration, observability, and responsible AI patterns in Azure.

Work in Progress
Coming Q2 2026

Want to connect with others?

Our Discord community is here to support you

Join Our Discord Community

Connect with like-minded professionals studying for their Azure certifications. Share tips, ask questions, find study partners, and stay motivated on your learning journey.

Active Discussions

Get answers to your questions from peers and experts

Study Groups

Find accountability partners and study together

Celebrate Wins

Share your certification achievements with the community

Join Discord Community