Azure SQL Database and Azure SQL Managed Instance are both PaaS offerings for SQL Server on Azure, but they cater to different migration and modernization needs.

Let’s see them in action. Imagine you have a legacy application that must have SQL Server Agent jobs for scheduled tasks.

# On Azure SQL Managed Instance, you can directly create and manage SQL Server Agent jobs
EXEC msdb.dbo.sp_add_job @job_name = N'MyDailyBackupJob';
GO
EXEC msdb.dbo.sp_add_jobstep @job_name = N'MyDailyBackupJob', @step_name = N'Run Backup', @subsystem = N'TSQL', @command = N'BACKUP DATABASE [MyDatabase] TO DISK = N''/var/opt/mssql/backup/MyDatabase.bak'' WITH NOFORMAT, NOINIT, NAME = N''MyDailyBackupJob - Full Backup'', SKIP, NOREWIND, NOUNLOAD, STATS = 10';
GO
EXEC msdb.dbo.sp_add_schedule @schedule_name = N'DailySchedule', @freq_type = 4, @freq_interval = 1, @freq_subday_type = 8, @freq_subday_interval = 12, @active_start_time = 000000;
GO
EXEC msdb.dbo.sp_attach_schedule @job_name = N'MyDailyBackupJob', @schedule_name = N'DailySchedule';
GO

Contrast this with Azure SQL Database, which doesn’t have SQL Server Agent. You’d typically use Azure Automation, Azure Functions, or Elastic Jobs to achieve similar scheduling functionality.

The core problem Azure SQL Managed Instance solves is enabling lift-and-shift migrations of on-premises SQL Server applications with minimal code or configuration changes. It provides near 100% compatibility with the latest stable version of SQL Server Enterprise Edition. This means features like SQL Server Agent, cross-database queries, CLR assemblies, and Service Broker work out of the box.

Azure SQL Database, on the other hand, is designed for modern cloud applications. It’s a fully managed relational database-as-a-service that offers intelligent features, automatic patching, backups, and high availability. It has a different, more streamlined feature set optimized for cloud-native development. For instance, it offers serverless compute and hyperscale storage tiers that SQL Managed Instance doesn’t directly expose in the same way.

The primary levers you control are the service tier and compute size. For Azure SQL Database, you choose between General Purpose, Business Critical, and Hyperscale, with vCore or DTU models available. For SQL Managed Instance, you select General Purpose or Business Critical, always with the vCore model, and then the number of vCores and storage size.

Here’s a look at the configuration for a SQL Managed Instance:

{
  "properties": {
    "managedInstanceLicenseType": "LicenseIncluded",
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "dnsZone": "xxxx.database.windows.net",
    "storageSizeInGB": 32,
    "vCores": 8,
    "sku": {
      "name": "GP_Gen5",
      "tier": "GeneralPurpose",
      "family": "Gen5",
      "capacity": 8
    },
    "tags": {
      "environment": "production"
    }
  }
}

And for Azure SQL Database:

{
  "properties": {
    "requestedServiceObjectiveName": "S0", // Or "Basic", "Standard", "Premium", "PremiumRS", "GeneralPurpose", "BusinessCritical", "Hyperscale"
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "maxSizeBytes": "536870912000", // 500 GB
    "zoneRedundancy": "Enabled",
    "tags": {
      "app": "mywebapp"
    }
  }
}

The key difference in how they manage resources relates to networking and instance isolation. SQL Managed Instance is deployed into your virtual network, giving you private IP addresses and full control over network security groups and firewalls. Azure SQL Database, by default, is accessible over public endpoints, though you can secure it with private endpoints, VNet service endpoints, and firewall rules. This network isolation is a significant factor for legacy applications that might have strict network requirements.

One thing many people don’t realize is that while SQL Managed Instance aims for high compatibility, there are still subtle differences in behavior for certain system stored procedures or dynamic management views (DMVs) compared to on-premises SQL Server. For instance, sys.dm_os_wait_stats might not contain all the same wait types you’re accustomed to seeing, or certain administrative privileges on-premises might be abstracted away in the PaaS model. This means thorough testing is always recommended, even for "lift-and-shift" scenarios.

The next step in understanding these services is exploring their distinct pricing models and how they impact cost optimization for different workloads.

Want structured learning?

Take the full Azure course →