D3 · Management, Security, and Compliance

Security in Azure: Defense in Depth

Multiple layers of protection, encryption, firewalls, and threat detection. Security in Azure isn't a single tool but a layered strategy where each level protects the next.

Defense in Depth — 7 layers of security

Defense in Depth is a layered security strategy. If an attacker breaks through one layer, the following layers slow down or stop the attack. No single layer is enough on its own.

L7

Data

The most valuable layer. Encryption of data at rest and in transit. Granular access with . Regular backups.

In Azure

Azure Storage Encryption, Transparent Data Encryption in SQL, Azure Backup

L6

Application

Secure code: input validation, no hardcoded secrets, mandatory HTTPS, secure error handling.

In Azure

Key Vault for secrets, API Management, App Service with TLS, OWASP Top 10 mitigations

L5

Compute

Up-to-date operating systems, active antimalware, JIT (Just-in-Time) access to administrative ports.

In Azure

Microsoft Antimalware for Azure, automatic VM patches, Defender for Servers, JIT access from Defender for Cloud

L4

Network

Network segmentation. Only allow the minimum required traffic. Deny by default. Encryption of internal traffic.

In Azure

NSG (Network Security Groups), private subnets, VNet peering, VPN Gateway, Private Endpoints

L3

Perimeter

Protection against external network attacks: DDoS, port scanning, unauthorized access from the internet.

In Azure

Azure DDoS Protection, Azure Firewall, WAF (Web Application Firewall) on Application Gateway

L2

Identity and access

Control who accesses what. MFA, RBAC, Conditional Access, least privilege, sign-in monitoring.

In Azure

Microsoft Entra ID, MFA, RBAC, Conditional Access, Privileged Identity Management (PIM)

L1

Physical

Physical access to datacenters. Biometrics, 24/7 guards, CCTV, security traps. Microsoft's responsibility.

In Azure

Microsoft infrastructure: controlled access, cameras, guards, certified disk destruction

For the exam — layer order

Memorize from outside in: Physical → Identity → Perimeter → Network → Compute → Application → Data. Data is the ultimate target, which is why it's at the center (most protected).

Interactive diagram — hover over each layer

Encryption — at rest and in transit

Azure encrypts data in two states: stored (at-rest) and traveling over the network (in-transit). Both are compliance requirements in virtually every regulatory framework.

Encryption at rest

Protects stored data: if someone steals a physical disk, the data is unreadable without the key.

Azure Storage

Automatic AES-256 by default. There's no option to disable it.

Azure SQL Database

TDE (Transparent Data Encryption). Encrypts the database file, logs, and backups.

Azure Disk Encryption

Encrypts VM disks using BitLocker (Windows) or DM-Crypt (Linux). Keys stored in Key Vault.

Azure Cosmos DB

Automatic AES-256. Also encrypts indexes and metadata.

Key management

Microsoft-managed keys (default, no extra cost) or Customer-managed keys (CMK) in Key Vault for full control.

Encryption in transit

Protects data moving over the network: between client and server, between Azure services, between datacenters.

TLS 1.2+

Standard for HTTPS. Azure rejects connections with TLS 1.0/1.1 on new services.

Mandatory HTTPS

App Service, Storage, API Management — "HTTPS only" option that redirects HTTP to HTTPS.

IPSec / VPN

Traffic between on-premises and Azure. VPN Gateway encrypts with IPSec/IKE.

ExpressRoute

Private connection (not over the public internet). Additional MACsec option for layer-2 encryption.

Practical rule: never HTTP in production. Always TLS 1.2+ for APIs and storage. Azure automatically encrypts internal traffic between datacenters.

Icon-networking-67

vs — when to use each

Both control network traffic, but at different levels. The AZ-900 tests whether you can tell them apart.

DimensionNSG (Network Security Group)Azure Firewall
LevelSubnet or NIC (network layer)Entire VNet or centralized hub
Works withPort, IP, protocol rulesFQDN, URLs, threat intelligence, IDPS
InspectionBasic: allow/deny by 5-tupleDeep: packet inspection, TLS inspection
CostIncluded (no extra cost)Paid (~$1.25/hour + processed data)
LoggingFlow logs → Storage/Log AnalyticsDetailed Azure Monitor logs
Built-in HAYes, automaticYes, automatic multi-zone
Use caseSegment subnets within a VNetPerimeter protection, controlled internet egress, network hub

Typical architecture: NSG + Firewall together

Azure Firewall:In the "AzureFirewallSubnet" subnet. All outbound traffic to the internet passes through here. Filters by FQDN (allow app.contoso.com, deny *.malware.com).
NSGs:In each subnet. Specific rules: web-tier subnet only receives port 443. db-tier subnet only receives traffic from the web-tier subnet on port 1433.
Result:East-west traffic (between subnets) controlled by NSGs. North-south traffic (internet inbound/outbound) controlled by Azure Firewall.
Related labD3 · Management, security, and compliance

Configure Azure Firewall with an application rule

Deploy Azure Firewall in a VNet and add an FQDN-based application rule — something an NSG can't do.

Tell apart Azure Firewall from an NSG (north-south vs. east-west traffic)
Deploy Azure Firewall in a VNet with the Standard SKU

+1 more...

9 min15 steps
Icon-security-245

— centralized secrets management

Key Vault stores and controls access to secrets, encryption keys, and certificates. It removes the need to store credentials in source code or environment variables.

Secrets

Passwords, connection strings, API keys, OAuth tokens. Versioned: every update creates a new version.

SQL Server password
Stripe API key
JWT signing secret

Keys

Cryptographic keys for encryption/decryption. RSA, EC. HSM-backed (hardware security module) for maximum security.

Master key for SQL TDE
Key for encrypting sensitive data
Token signing key

Certificates

TLS/SSL certificates for websites and apps. Automatic renewal. Integrated with App Service, API Management, Front Door.

TLS certificate for api.contoso.com
Code signing certificate
Mutual TLS certificate for microservices

Recommended pattern: Managed Identity + Key Vault

1.Assign a Managed Identity to the App Service (or VM, Function, etc.)
2.Grant that Managed Identity permission to read secrets from Key Vault (Key Vault Access Policy or RBAC)
3.The app calls Key Vault at runtime to get the connection string
✓.Result: zero secrets in code, zero manual rotation, audited access
Related labD3 · Management, security, and compliance

Save a secret in Azure Key Vault

Create a Key Vault and save a secret, removing the need to leave passwords or connection strings in source code.

Understand what problem Key Vault solves compared to storing secrets in code
Create a Key Vault with the Azure RBAC permission model

+1 more...

7 min13 steps
Icon-security-248

Formerly called Azure Security Center + Azure Defender. It's the central platform for security posture and workload protection in Azure, on-premises, and other clouds.

Two main pillars

CSPM — Cloud Security Posture Management

Evaluates the security configuration of all your resources and generates a Secure Score (0-100%). Provides prioritized recommendations for improvement.

Free (basic features)

CWP — Cloud Workload Protection

Active real-time threat detection: malware on VMs, SQL injection attacks, suspicious activity in containers, etc.

Paid (by resource type)

Secure Score — how does it work?

Defender for Cloud evaluates your resources against security controls and assigns a score. Each control has a weight. Meeting more controls = higher score.

0-49%

High risk

Critical misconfigurations. Unpatched vulnerabilities.

50-74%

Medium risk

Important improvements pending but with a reasonable baseline.

75-100%

Well protected

Most critical controls implemented.

Icon-networking-72

DDoS (Distributed Denial of Service) attacks try to overwhelm services with massive traffic to make them inaccessible. Azure offers two levels of protection.

DDoS Network Protection (Basic)

Formerly called: Infrastructure Protection

Automatically enabled for all Azure customers at no extra cost. Protects Azure's infrastructure from common volumetric attacks.

  • Not customizable
  • No guaranteed mitigation SLA
  • No telemetry or alerts for the customer

DDoS IP Protection / Network Protection (Standard)

Formerly called: DDoS Standard

Paid plan. ML-driven adaptive mitigation tuned to your resources. Guaranteed SLA. Credits if the SLA is missed.

  • Real-time telemetry during attacks
  • Azure Monitor alerts
  • DDoS Rapid Response team support
  • Cost protection: Azure credits if an attack causes scale-out costs

Did you get this topic?

Test what you just learned

Which Azure service provides a security score (Secure Score) and prioritized recommendations to help protect resources?

Ready to test "Security - Defense in Depth"?

Put what you learned to the test with original AZ-900 exam questions.

Start AZ-900 mock exam

Unlimited mock exams with the Pro plan

Log in to track your progress.