Chapter 12 — Azure Database Services

Overview

Azure offers a comprehensive suite of managed database services — both relational (SQL-based) and non-relational (NoSQL). "Managed" means Azure handles backups, patching, scaling, and high availability automatically.

Azure Database Services:
  ├── Relational (SQL)
  │     ├── Azure SQL Database
  │     ├── Azure SQL Managed Instance
  │     ├── Azure Database for MySQL
  │     ├── Azure Database for PostgreSQL
  │     └── Azure Database for MariaDB
  └── Non-Relational (NoSQL)
        └── Azure Cosmos DB

Relational vs. Non-Relational Databases

Before diving into services, let's clarify the two types:

 

Relational (SQL)

Non-Relational (NoSQL)

Structure

Tables with rows and columns

Documents, key-value, graphs, columns

Schema

Fixed schema (defined in advance)

Flexible schema

Query language

SQL

Varies (JSON, APIs, etc.)

Best for

Structured data, transactions

Unstructured, fast, global-scale data

Examples

MySQL, PostgreSQL, SQL Server

Cosmos DB, MongoDB


1. Azure SQL Database

What Is It?

Azure SQL Database is a fully managed relational database service based on the latest stable version of Microsoft SQL Server. It is a PaaS service — Azure handles patching, backups, high availability, and scaling.

Key Features

Feature

Detail

Engine

SQL Server (latest stable)

Deployment

Single database or elastic pool

Scaling

Serverless (auto-pause/resume) or provisioned

High availability

99.99% SLA built-in

Backups

Automatic with up to 35-day retention

Security

Advanced Threat Protection, Always Encrypted, TDE

Geo-replication

Active geo-replication to up to 4 secondary regions

Purchasing Models

Model

Description

DTU (Database Transaction Units)

Bundled CPU + memory + I/O — simpler, less control

vCore

Choose exact CPU, memory, storage — more flexibility

Elastic Pools

An Elastic Pool lets multiple databases share a pool of resources — cost-effective when databases have variable and unpredictable usage.

Elastic Pool (100 DTUs shared)
├── Database A (peak: 40 DTUs)
├── Database B (peak: 30 DTUs)
└── Database C (peak: 40 DTUs)
→ Total peak would be 110 DTUs, but peaks don't overlap → 100 DTUs suffice

When to Use Azure SQL Database

  • New cloud-native applications using SQL Server

  • Modernizing existing SQL Server applications

  • When you want fully managed SQL with minimal DBA overhead


2. Azure SQL Managed Instance

What Is It?

Azure SQL Managed Instance is a fully managed SQL Server instance that offers near-100% compatibility with on-premises SQL Server. It fills the gap between Azure SQL Database (limited features) and running SQL Server in a VM (full management burden).

SQL Database vs. SQL Managed Instance

Feature

Azure SQL Database

SQL Managed Instance

SQL Server compatibility

Most features

Near 100%

Cross-database queries

Not supported

Supported

SQL Agent

Not supported

Supported

Linked servers

Not supported

Supported

VNet integration

Limited

Full native VNet

Migration

Requires app changes

Near lift-and-shift

When to Use SQL Managed Instance

  • Migrating on-premises SQL Server workloads to Azure with minimal changes

  • Applications using SQL Server-specific features (SQL Agent, CLR, linked servers)

  • When full VNet isolation is required


3. Azure Database for MySQL

What Is It?

Azure Database for MySQL is a fully managed MySQL database service in the cloud. Azure manages patching, backups, high availability, and scaling.

Key Features

Feature

Detail

Engine

MySQL Community Edition (5.7 and 8.0)

High availability

Zone-redundant HA with automatic failover

Backups

Automated, up to 35-day retention

Scaling

Burstable, General Purpose, Memory Optimized

Security

SSL enforcement, firewall, VNet integration

Compatibility

Full MySQL compatibility — drop-in replacement

Deployment Options

Option

Description

Flexible Server

Latest, recommended — full control over maintenance windows

Single Server

Legacy option — being retired

When to Use

  • Web applications using the LAMP stack (Linux, Apache, MySQL, PHP)

  • WordPress, Drupal, and other MySQL-based applications

  • E-commerce platforms running on MySQL


4. Azure Database for PostgreSQL

What Is It?

Azure Database for PostgreSQL is a fully managed PostgreSQL database service, built on the popular open-source PostgreSQL engine.

Key Features

Feature

Detail

Engine

PostgreSQL (versions 11 through 16)

Extensions

Supports popular PostgreSQL extensions

High availability

Zone-redundant HA

Backups

Automated, up to 35-day retention

Intelligent Performance

Query performance recommendations

Flexible Server

Latest recommended deployment option

When to Use

  • Applications built on PostgreSQL (Django, Ruby on Rails, etc.)

  • Geospatial applications (PostGIS extension support)

  • Complex queries and analytics on relational data


5. Azure Cosmos DB

What Is It?

Azure Cosmos DB is Microsoft's globally distributed, multi-model NoSQL database service. It is designed for applications that require:

  • Global scale

  • Single-digit millisecond response times

  • Flexible data models

Key Characteristics

Feature

Detail

Global distribution

Replicate data to any number of Azure regions — 1 click

Multi-model

Choose your data model and API

Latency

<10ms reads, <15ms writes at 99th percentile

Availability SLA

99.999% (five nines)

Consistency levels

5 levels — from Strong to Eventual

Serverless option

Pay per request, no capacity to manage

Supported APIs (Data Models)

API

Data Model

Use Case

NoSQL (Core SQL)

Documents (JSON)

General purpose NoSQL

MongoDB

Documents

MongoDB compatibility

Cassandra

Wide columns

Large-scale columnar data

Gremlin

Graph

Social networks, recommendation engines

Table

Key-value

Azure Table Storage migration

Cosmos DB Consistency Levels

Cosmos DB offers 5 consistency levels — a tradeoff between consistency and performance:

Strong      →  Highest consistency, highest latency
Bounded Staleness →  Reads lag behind writes by configured amount
Session     →  Consistent within a single client session (most common)
Consistent Prefix →  Reads never see out-of-order writes
Eventual    →  Lowest consistency, lowest latency, highest throughput

When to Use Cosmos DB

  • Global applications needing data close to users worldwide

  • Applications requiring <10ms response times at any scale

  • IoT applications with massive write volumes

  • E-commerce, gaming, social media at planet scale

  • Applications currently using MongoDB wanting managed cloud hosting


Database Services Comparison

Service

Type

Engine

Best For

Azure SQL Database

Managed SQL

SQL Server

Cloud-native SQL apps

SQL Managed Instance

Managed SQL

SQL Server

Lift-and-shift SQL Server

Azure Database for MySQL

Managed SQL

MySQL

MySQL-based web apps

Azure Database for PostgreSQL

Managed SQL

PostgreSQL

PostgreSQL apps

Azure Cosmos DB

Managed NoSQL

Multi-model

Global, low-latency apps


Key Decision Guide

Migrating SQL Server with minimal changes?  → SQL Managed Instance
Building new cloud-native SQL app?          → Azure SQL Database
Running WordPress or PHP/MySQL app?         → Azure Database for MySQL
Using Django or Rails with PostgreSQL?      → Azure Database for PostgreSQL
Need global scale, <10ms, NoSQL?            → Azure Cosmos DB

Quick Recap

Azure SQL Database      → Managed SQL Server (PaaS)
SQL Managed Instance    → Near-complete SQL Server compatibility
Azure DB for MySQL      → Managed MySQL
Azure DB for PostgreSQL → Managed PostgreSQL
Azure Cosmos DB         → Global NoSQL, multiple APIs, 5 nines SLA

Official References


Next Chapter → Chapter 13: Azure Identity Services