Capabilities of Microsoft Security Solutions · Topic 2 of 5

Network Segmentation, NSGs, Bastion and Key Vault

SC-900 Azure network controls: segmentation with virtual networks, NSG rules, Azure Bastion for safe admin access, and Key Vault for secrets and keys.

  • 6 min
In a nutshell
  • Segmentation uses virtual networks and subnets to limit how far an attack can spread.
  • An NSG has prioritised allow and deny rules on address, port and protocol.
  • Azure Bastion gives RDP and SSH from the portal over TLS without public IP addresses on the machines.

What it is

Inside Azure, good security means keeping things apart, controlling who may talk to whom, reaching servers safely and keeping secrets out of code. This topic covers four tools for that: virtual networks for segmentation, network security groups for traffic rules, Azure Bastion for administrative access, and Azure Key Vault for secrets.

Virtual networksegments into subnetsNSGallows or denies trafficBastionsafe admin accessKey Vaultstores secrets and keys

How it works

Network segmentation

Segmentation splits a network into smaller parts so that a problem in one part cannot spread to the others. In Azure, a virtual network is your private network, and it is divided into subnets. You might place web servers in one subnet, application servers in another and databases in a third, and then control the traffic between them. If an attacker reaches a web server, the database subnet is still protected. Segmentation limits the blast radius of a breach, which fits the Zero Trust idea of assuming breach.

Network security groups (NSGs)

A network security group contains security rules that allow or deny network traffic to resources in a virtual network. It can be attached to a subnet or to a single network interface.

Each rule has:

  • A priority number, where the lowest number is checked first.
  • A source and a destination, such as an address range or a service tag.
  • A port and a protocol.
  • An action, allow or deny, and a direction, inbound or outbound.

A rule might allow HTTPS (port 443) from the internet to the web subnet, and another might allow the database port only from the application subnet. NSGs have default rules that allow traffic inside the virtual network and deny inbound traffic from the internet, and you add your own rules above them. Application security groups let you write rules for groups of servers by role instead of by address.

NSGs filter on address, port and protocol. They cannot filter by domain name or inspect web requests, which is the job of Azure Firewall and WAF.

Azure Bastion

Administrators often need to reach virtual machines using remote desktop or SSH. Opening those ports to the internet is dangerous. Azure Bastion is a managed service that lets you connect to a virtual machine from the Azure portal over TLS, with no public IP address on the machine and no RDP or SSH port open to the internet. The machines stay private, and the connection is protected.

Azure Key Vault

Applications need secrets such as passwords, connection strings and encryption keys. Storing them in code or in files is risky. Azure Key Vault is a secure store for them.

ItemWhat it holds
SecretsSmall sensitive values such as passwords, tokens and connection strings
KeysCryptographic keys for encrypting and signing data
CertificatesTLS and other certificates, with managed renewal

Access to a vault is controlled by identity, so an application with a managed identity can read a secret with no password in its code. Keys can be protected by hardware security modules in the Premium tier. Every access is logged. Features such as soft delete and purge protection help recover from accidental deletion.

Which tool for which job?

The needTool
Separate web, application and database tiersSubnets in a virtual network
Allow only port 443 from the internet to a subnetA network security group
Reach a VM without exposing RDP to the internetAzure Bastion
Store a database password outside application codeAzure Key Vault

A worked scenario

A company builds a three tier application. It puts the web, application and database tiers in separate subnets. An NSG on the database subnet allows connections on the database port only from the application subnet, and denies everything else. Administrators connect to the virtual machines through Azure Bastion, so no machine has a public address for remote desktop. The application reads its database password from Key Vault using a managed identity, so the password never appears in the source code.

The default NSG rules

Every NSG starts with default rules that you cannot delete, but can override with rules of lower priority numbers.

DirectionDefault ruleEffect
InboundAllowVnetInBoundAllow traffic from inside the virtual network
InboundAllowAzureLoadBalancerInBoundAllow the Azure load balancer probes
InboundDenyAllInBoundDeny all other inbound traffic
OutboundAllowVnetOutBoundAllow traffic to inside the virtual network
OutboundAllowInternetOutBoundAllow traffic to the internet
OutboundDenyAllOutBoundDeny all other outbound traffic

Because DenyAllInBound is last, traffic from the internet is blocked unless you add an allow rule.

How Bastion is deployed

Azure Bastion is deployed into its own subnet, named AzureBastionSubnet, in the virtual network. Administrators open the virtual machine in the Azure portal, choose Connect and then Bastion, and a remote session opens in the browser. The virtual machine needs no public IP address, and the NSG does not have to allow RDP or SSH from the internet.

Controlling access to Key Vault

Access to a Key Vault is governed by Azure role based access control or by access policies. An application with a managed identity is given just the permission it needs, such as reading secrets, and nothing more. Because every operation is logged, security teams can see which identity read which secret and when. Soft delete keeps a deleted vault or secret recoverable for a retention period, and purge protection prevents it from being erased early.

What to remember for the exam

  • Segmentation uses virtual networks and subnets to limit how far an attack can spread.
  • An NSG has prioritised allow and deny rules on address, port and protocol.
  • Azure Bastion gives RDP and SSH from the portal over TLS without public IP addresses on the machines.
  • Key Vault stores secrets, keys and certificates.
  • Managed identities let an app use Key Vault with no stored password.
Exam tip

"Without opening RDP or SSH to the internet" is Azure Bastion. "Store passwords and keys" is Key Vault.

How the exam asks about this

  • "Which service connects to a VM through the portal without a public IP?" Azure Bastion.
  • "Where should an application keep its database password?" Azure Key Vault.
  • "Which rule is evaluated first, priority 100 or 200?" 100.
  • "Which feature allows only the web tier to reach the database subnet?" A network security group.

Common mistakes

Believing an NSG can filter by domain name. It works on addresses and ports. Azure Firewall filters by domain.

Opening RDP to the internet for convenience. Bastion removes that need.

Putting secrets in application settings or code. Key Vault exists for them.

Thinking a single flat network is fine. Without segmentation, one breach can reach everything.

Check yourself

  • What does an NSG rule consist of?

    A priority, a source and destination, a port and protocol, and an allow or deny action.

  • What does Azure Bastion avoid exposing?

    RDP and SSH ports and public IP addresses on virtual machines.

  • What three kinds of item does Key Vault store?

    Secrets, keys and certificates.

Topic 2 of 5 in Capabilities of Microsoft Security Solutions

Test yourself on Capabilities of Microsoft Security Solutions

The full Microsoft SC-900 question bank has 503 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Microsoft. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.