Azure SQL, SQL Managed Instance and Cosmos DB
😟 THE PROBLEM
The team runs its own database servers and spends nights patching and fixing backups.
😊 THE SOLUTION
Choose a managed Azure database such as SQL Database or Cosmos DB.
- Patching database servers✓ PaaS databases are patched for you
- Global users need fast data✓ Cosmos DB multi-region
- Migrating old SQL Server✓ SQL Managed Instance
Quick answer
Azure offers databases from most control to most managed. SQL Server on Azure VMs (IaaS) gives full control. Azure SQL Managed Instance (PaaS) offers near-complete SQL Server compatibility for easy migrations. Azure SQL Database (PaaS) is a fully managed modern database. Azure Cosmos DB is a globally distributed NoSQL database with very low latency.
Start with a question
Your shopping app needs a database. Do you install one yourself or let Azure run it?
Azure offers both, and several options in between.
Explain it like I’m 10
The technical explanation
| Option | Type | Best for |
|---|---|---|
| SQL Server on Azure VMs | IaaS | Full control, specific versions, OS access |
| Azure SQL Managed Instance | PaaS | Migrating existing SQL Server with minimal changes |
| Azure SQL Database | PaaS | New cloud apps, serverless and Hyperscale options |
| Azure Cosmos DB | PaaS NoSQL | Global apps needing low latency and flexible schema |
Real-world business scenario
A global gaming company
- The problem
- Player profiles needed fast reads and writes worldwide, and the purchase ledger needed strict relational integrity.
- What they used
- Cosmos DB with multi-region writes for profiles; Azure SQL Database for purchases.
- Why that choice
- Each data shape gets the right database.
- The result
- Fast profiles everywhere and reliable purchase records.
When to use it and when not to
✓ Use it when…
- **SQL Database** for most new relational apps.
- **Managed Instance** for SQL Server migrations.
- **Cosmos DB** for global, low-latency NoSQL.
✕ Think twice when…
- Running your own SQL on VMs unless you need the control.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner What is the difference between Azure SQL Database and Cosmos DB?
Model answer
Azure SQL Database is a relational database with tables and SQL queries. Cosmos DB is a NoSQL database for flexible JSON-style data that can be replicated globally with very low latency.
Intermediate When would you choose SQL Managed Instance over SQL Database?
Model answer
When migrating existing SQL Server databases that rely on instance-level features such as SQL Agent jobs, cross-database queries or CLR, and you want PaaS with minimal changes.
Experienced developer When would you still run SQL Server on a VM?
Model answer
When you need OS-level access, a specific SQL Server version or feature not available in PaaS, third-party software installed alongside, or full control of patch timing. The trade-off is that you manage patching, backups and high availability yourself.
Test yourself with exercises
3 original practice questions in the AZ-900 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Quick revision
Key points
- SQL on VM = IaaS, full control.
- SQL Managed Instance = PaaS, near-full SQL Server compatibility.
- SQL Database = fully managed PaaS.
- Cosmos DB = global, low-latency NoSQL.
Important terminology
- Azure SQL Database
- Fully managed PaaS relational database based on the SQL Server engine.
- SQL Managed Instance
- PaaS with near-100% SQL Server compatibility, ideal for lift-and-shift.
- Azure Cosmos DB
- Globally distributed, multi-model NoSQL database with low latency and elastic scale.
Common mistakes
- Using Cosmos DB for heavily relational, join-based workloads.
Exam tips
- Databases are not in the current AZ-900 outline, but they appear often in interviews.
Five quick revision questions
-
1.Which option gives full control of SQL Server?Show
SQL Server on Azure VMs.
-
2.Which PaaS option is best for lift-and-shift of SQL Server?Show
Azure SQL Managed Instance.
-
3.Which option is a globally distributed NoSQL database?Show
Azure Cosmos DB.
-
4.Which cloud service type is Azure SQL Database?Show
PaaS.
-
5.Who patches Azure SQL Database?Show
Microsoft.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.