# Azure SQL and Azure Database for PostgreSQL — Azure

Source: https://www.skillbyai.com/en/azure/d-relational

> Choose a managed relational database tier and plan for failover.

## Managed relational databases

**Azure SQL Database** is a managed SQL Server engine: Azure handles patching, backups (with point-in-time restore) and high availability. Purchasing models include **vCore** (choose compute and storage separately) and **DTU** (bundled units). The **serverless** compute tier auto-scales and can auto-pause when idle, which suits dev databases and spiky workloads; **elastic pools** share resources among many small databases, useful for SaaS apps with a database per customer. **Azure SQL Managed Instance** offers near-complete SQL Server compatibility for lift-and-shift. For open-source engines, **Azure Database for PostgreSQL – Flexible Server** and **Azure Database for MySQL – Flexible Server** provide managed instances with zone-redundant HA options. For disaster recovery across regions, Azure SQL offers **active geo-replication** and **failover groups**, which give a listener endpoint that follows the primary.

## A serverless Azure SQL database with Entra-only authentication

Using Entra authentication avoids SQL passwords entirely.

```bash
az sql server create -g rg-shop-dev-cin -n sql-shop-dev -l centralindia \
  --enable-ad-only-auth \
  --external-admin-principal-type Group \
  --external-admin-name shop-dba --external-admin-sid <group-object-id>

az sql db create -g rg-shop-dev-cin -s sql-shop-dev -n shopdb \
  --edition GeneralPurpose --compute-model Serverless \
  --family Gen5 --capacity 2 --auto-pause-delay 60
```

## Renting a serviced apartment

A VM with SQL Server installed is renting an empty flat: you fix the plumbing. Azure SQL Database is a serviced apartment: cleaning, repairs and security are included; you just live there, within the house rules.

**Quiz:** A development database is idle most nights and weekends. Which Azure SQL option reduces cost most directly?

- [ ] Business Critical tier
- [ ] Active geo-replication
- [ ] SQL Managed Instance
- [x] Serverless compute tier with auto-pause

*Answer:* Serverless compute tier with auto-pause. Serverless auto-pauses when idle, so you pay only for storage during those periods.
