Designing for relational data
Choose between SQL Database, SQL Managed Instance and SQL Server on VMs, then pick the service tier, compute tier, scaling approach and data protection.
In this lesson you'll learn
- Which Azure SQL option fits each migration or new-build scenario
- Purchasing models and service tiers: General Purpose, Business Critical, Hyperscale
- Scaling: elastic pools, read scale-out, sharding and serverless
- Protecting data: encryption, auditing and backups
1. Choosing the Azure SQL option
Refresher: IaaS versus PaaS for databases
With SQL Server on a VM you manage the operating system, patching and backups yourself. With Azure SQL Database or SQL Managed Instance, Microsoft runs the platform: patching, backups and high availability are built in.
| Option | Recommend when |
|---|---|
| Azure SQL Database (single or elastic pool) | New cloud apps, or databases that don't need instance-level features. Least management. |
| Azure SQL Managed Instance | Lifting and shifting existing SQL Server databases that use instance features: SQL Agent jobs, cross-database queries, linked servers, CLR, Service Broker. Runs inside your VNet. |
| SQL Server on Azure VMs | You need OS-level access, a specific SQL Server version, or features PaaS doesn't support (for example SSRS on the same server). |
| Azure Database for PostgreSQL or MySQL (Flexible Server) | Apps built on open-source engines. |
2. Purchasing models and tiers
The vCore model lets you choose compute and storage separately and use Azure Hybrid Benefit. The older DTU model bundles them into simple sizes. Most design questions use vCore.
| Service tier | Key features | Choose for |
|---|---|---|
| General Purpose | Remote storage, balanced price and performance | Most business workloads |
| Business Critical | Local SSD, lowest latency, several replicas, one free readable replica, in-memory OLTP | High transaction rates, low latency, fast failover |
| Hyperscale | Storage up to 128 TB, fast scaling and backups, up to 4 HA replicas and named replicas for reads | Very large or fast-growing databases |
Compute tier: provisioned compute is billed per hour and always on. Serverless (General Purpose and Hyperscale) scales automatically and, in General Purpose, can pause when idle, so you pay for storage only. Serverless suits intermittent, unpredictable usage such as dev and test.
3. Scalability
| Requirement | Recommend |
|---|---|
| Many databases with varying, unpredictable peaks (for example one per customer) | Elastic pool |
| Offload read-only reporting queries | Read scale-out (Business Critical) or named replicas (Hyperscale) |
| Grow beyond the limits of one database | Hyperscale, or sharding with the elastic database tools |
| Usage is idle most of the day | Serverless compute tier |
4. Data protection
- Encryption at rest: Transparent Data Encryption (TDE) is on by default. Use customer-managed keys in Key Vault when you must control the key.
- Encryption in use: Always Encrypted keeps chosen columns encrypted even from database administrators.
- Sensitive data in results: dynamic data masking hides values, such as card numbers, from non-privileged users.
- Who did what: auditing to a Log Analytics workspace, storage or Event Hubs.
- Threats: Microsoft Defender for SQL detects SQL injection and unusual access.
- Backups: automatic, with point-in-time restore for 1 to 35 days and long-term retention up to 10 years.
Example
Meadowgate Traders is moving 40 on-premises SQL Server databases that rely on SQL Agent jobs and cross-database queries. Rewriting them isn't an option. The architect recommends SQL Managed Instance in the General Purpose tier, with Business Critical for the two order-processing databases that need the lowest latency. Azure Hybrid Benefit reuses the existing licences.
Exam traps to remember
- SQL Agent, cross-database queries or linked servers: SQL Managed Instance, not SQL Database.
- "Hide data from DBAs" is Always Encrypted. "Hide data from app users" is dynamic data masking.
- Only Business Critical includes a free read-only replica for reporting.
- Serverless auto-pause is available in General Purpose, but it isn't the right choice for steady, busy workloads.
Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-305 Azure Solutions Architect app.
Practise in the app