Domain 2 β€” Module 2 of 8 25%
8 of 28 overall
Domain 2: Secure storage, databases, and networking Free ⏱ ~11 min read

Azure SQL Security + Defender for Databases

Securing Azure SQL Database and Managed Instance β€” Microsoft Entra authentication, platform hardening, Transparent Data Encryption (TDE) with customer-managed keys, Always Encrypted, dynamic data masking, auditing, and Defender for Databases threat protection.

Azure SQL security in one module

Simple explanation

Azure SQL covers Azure SQL Database (single DB + elastic pool, PaaS), Azure SQL Managed Instance (near-100% SQL Server compat, PaaS), and SQL Server on Azure VMs / Arc. Plus a Defender for Databases plan that also covers open-source databases (PostgreSQL, MySQL).

SC-500 testable layers:

  • Authentication β€” Microsoft Entra-only (preferred) vs mixed-mode with SQL auth users
  • Network β€” server firewall, VNet service endpoint, Private Endpoint, public endpoint disabled
  • Encryption β€” Transparent Data Encryption (TDE) on by default with platform-managed key, customer-managed TDE via Key Vault, Always Encrypted (column-level), dynamic data masking
  • Auditing β€” server-level and database-level audit policies sending to Log Analytics / Storage / Event Hub
  • Defender for Databases β€” detects SQL injection, anomalous queries, brute-force, suspicious access; per-database billing

Authentication: Entra-only is the SC-500 default

The right answer:

  1. Set a Microsoft Entra admin on the logical server (a user, group, or service principal β€” group is best practice for survivability).
  2. Set Entra-only authentication on the server to Enabled β€” disables SQL auth users.
  3. Create contained users mapped to Entra principals via CREATE USER [<entra-name>] FROM EXTERNAL PROVIDER and grant minimum DB roles (db_datareader, db_datawriter).
  4. Consuming apps authenticate using their managed identity via the Azure Identity SDK (DefaultAzureCredential) + connection string with Authentication=Active Directory Default;....

SQL auth users are blocked entirely once Entra-only is on. The result: every connection is attributable to an Entra principal, MFA / Conditional Access applies, no passwords in app config.

Network hardening

Azure SQL network settings β€” Private Endpoint + public access disabled is the SC-500 default
Network settingWhat it doesWhen it's the right answer
Public network access: DisabledServer reachable only via Private EndpointProduction β€” combined with PE in consumer VNet
Private EndpointPrivate IP in customer VNet via `privatelink.database.windows.net`Highest assurance
VNet service endpointSubnet-level allowance via `Microsoft.Sql` service endpoint + firewall rule on the server referencing the subnetMiddle ground where Private Endpoint is overkill
Server firewall β€” IP rulesExplicit public CIDR allowlistLegacy compatibility; combine with other layers
'Allow Azure services and resources to access this server'Allows ALL Azure first-party services on Microsoft IP space β€” broad and often misunderstoodAlmost never the right exam answer; the trap setting

TDE, Always Encrypted, dynamic data masking

Azure SQL encryption + masking β€” TDE for at-rest, Always Encrypted for column-level, masking for display
FeatureWhat it encrypts/masksKey custody
Transparent Data Encryption (TDE)Data files at rest (storage layer); transparent to the applicationService-managed (platform key) or customer-managed (Key Vault) β€” `db_owner`+ controls
TDE with customer-managed key (BYOK)Same as TDE; the wrapping key lives in customer Key VaultCustomer (Key Vault, optionally HSM-backed); rotation policy via KV
Always EncryptedSpecific columns β€” encrypted in the client driver before reaching the engineCustomer (Column Master Key in Key Vault); the engine never sees plaintext
Always Encrypted with secure enclavesSame as Always Encrypted, plus comparison/range/LIKE operations supported in a TEE on the serverCustomer (CMK in KV) + TEE attestation
Dynamic data maskingDisplay-time masking for non-privileged users; underlying data unchangedN/A β€” no encryption; mask defined per column

The SC-500 exam pattern: when a scenario says β€œthe application or DBA must NEVER see the plaintext”, the answer is Always Encrypted (the engine never sees plaintext either). When the scenario says β€œprotect data at rest with customer keys”, the answer is TDE with customer-managed key. When the scenario says β€œthe data should look masked to non-privileged users but unchanged underneath”, the answer is dynamic data masking.

Auditing

Azure SQL auditing logs events at the server or database level. Destinations:

  • Log Analytics workspace β€” Sentinel-ready; queryable with KQL via the SQLSecurityAuditEvents table
  • Storage account β€” long-term archive
  • Event Hub β€” real-time streaming to third-party SIEMs or custom processors

Set a server-level audit policy covering all DBs as the baseline; per-DB policies layer on for noisy DBs needing finer control. Audit immutability via Storage account immutability policies.

Defender for Databases

The plan covers Azure SQL DB, Managed Instance, SQL Server on VM/Arc, and PostgreSQL/MySQL flexible servers. What it detects:

  • SQL injection patterns
  • Anomalous client login (atypical user, location, application name)
  • Brute-force attempts on the SQL endpoint
  • Vulnerability assessment β€” Defender for SQL VA runs a periodic scan, surfacing misconfigurations and weak baselines
  • Data exfiltration patterns

Plan enabled per subscription or per database (granularity depends on database type). Alerts route to Defender for Cloud β†’ Defender XDR β†’ Sentinel.

Scenario: Esme hardens the bank’s core payments database

  1. Entra-only authentication enabled on the logical server. Entra admin = Payments-DBAdmins group (PIM-eligible).
  2. Network: public network access disabled. Private Endpoint in the payments VNet.
  3. TDE with customer-managed key in HSM-backed Key Vault; annual rotation.
  4. Always Encrypted on customers.card_number and customers.ssn columns; Column Master Key in HSM-backed Key Vault; the engine never sees plaintext.
  5. Dynamic data masking on customers.email and customers.phone for non-privileged users.
  6. Server-level audit policy to Log Analytics workspace shared with Sentinel.
  7. Defender for Databases enabled. Vulnerability assessment scheduled weekly; alerts to Sentinel.

The auditor sees: every connection attributable, no SQL auth users exist, sensitive columns encrypted client-side, masking for non-privileged read paths, full audit trail in Sentinel, threat detection on.

Key terms

Question

What does Entra-only authentication on an Azure SQL logical server do?

Click or press Enter to reveal answer

Answer

Disables SQL authentication users entirely β€” only Microsoft Entra principals (users, groups, service principals, managed identities) can connect. The logical server has a designated Entra admin; contained DB users are created via `CREATE USER [name] FROM EXTERNAL PROVIDER`. The SC-500 default for new SQL deployments.

Click to flip back

Question

What's the difference between Transparent Data Encryption (TDE) and Always Encrypted?

Click or press Enter to reveal answer

Answer

TDE encrypts data at rest in the storage layer β€” the database engine sees plaintext (necessary for indexing and queries). Always Encrypted encrypts specific columns in the client driver before data reaches the engine β€” the engine NEVER sees plaintext for those columns. TDE protects against data file theft; Always Encrypted protects against the DBA and the engine itself.

Click to flip back

Question

What is dynamic data masking in Azure SQL?

Click or press Enter to reveal answer

Answer

Display-time masking applied to specific columns when read by non-privileged users β€” underlying data is unchanged. Used for masking PII (email, phone, SSN) in dev/test environments or for service accounts that don't need plaintext. Doesn't protect against storage-level access or against users with the `UNMASK` permission.

Click to flip back

Question

Where can Azure SQL audit logs be sent?

Click or press Enter to reveal answer

Answer

Three destinations: Log Analytics workspace (Sentinel-ready, KQL queryable via `SQLSecurityAuditEvents`), Storage account (long-term archive, immutability supported), Event Hub (real-time streaming to third-party SIEMs or custom processors). Server-level policies cover all DBs; per-DB policies layer on top.

Click to flip back

Question

What does Microsoft Defender for Databases detect?

Click or press Enter to reveal answer

Answer

SQL injection patterns, anomalous logins (atypical user, location, application name), brute-force attempts on the SQL endpoint, vulnerability assessment findings, and data exfiltration patterns. Covers Azure SQL DB, Managed Instance, SQL Server on VM/Arc, PostgreSQL flexible server, MySQL flexible server. Alerts route to Defender for Cloud and Defender XDR.

Click to flip back

Knowledge check

Knowledge Check

Esme at Northwind Bank needs to ensure the application and the database administrator NEVER see the plaintext of credit-card-number columns in the payments database. The application reads the data into client memory for processing. Which encryption fits?

Knowledge Check

Ravi at Maple Genomics created an Azure SQL Managed Instance for genomics metadata. He wants ONLY managed identities of two specific App Services to be able to connect β€” no SQL auth users, no humans except a PIM-elevated DBA group. Which configuration is correct?

Knowledge Check

Asha at Aurora Health Service is enabling threat protection for the hospital's Azure SQL Managed Instance + 4 Azure Database for PostgreSQL flexible servers. Which Defender plan covers all five?

What’s next

Next: NSGs, ASGs, and Azure Virtual Network Manager β€” the L3/L4 segmentation layer for Azure networks.