Lesson 1 of 4 Relational Data Solutions

Choosing a Relational Service in Azure

This lesson explains the Azure SQL family and the open-source relational services.

Learning outcomes

After completing this lesson, you will be able to:

  • Compare the three Azure SQL products.
  • Describe PostgreSQL and MySQL flexible servers.
  • Choose a relational service from stated requirements.
  • Explain Azure Hybrid Benefit and reserved capacity.

When relational storage is the right choice

A relational database stores data in tables with a defined schema and relationships between them. It suits transactional workloads that need consistency: ACID transactions ensure that an order and its stock movement either both commit or both fail. It also suits data with complex queries and joins. Before recommending a service, an architect should confirm that the data really is relational, as high-volume semi-structured data is usually better placed in a service such as Azure Cosmos DB.

Azure's relational options differ mainly in how much is managed by Microsoft and in how closely they match an existing engine. The more that Microsoft manages, the less compatibility and control the customer has.

The Azure SQL family

Three products make up the Azure SQL family, and all use the SQL Server engine.

Azure SQL Database

Azure SQL Database is a fully managed platform as a service (PaaS) database. Microsoft handles patching, backups and high availability, and the customer manages schema, indexes and queries. Each database is logically isolated, and it is built for cloud applications. It offers the widest range of scaling options, including serverless compute and Hyperscale. Some instance-level features of SQL Server are unavailable: SQL Server Agent is absent, although elastic jobs exist as an alternative, and cross-database queries are limited.

Azure SQL Managed Instance

Azure SQL Managed Instance is also PaaS, but it provides an entire SQL Server instance rather than a single database. It runs inside a dedicated subnet of a virtual network and has near-complete compatibility with SQL Server. It supports SQL Server Agent, cross-database queries and transactions, linked servers, CLR modules, Service Broker, change data capture and transactional replication. It is usually the recommendation for migrating an existing SQL Server application with the least change while removing the burden of the operating system.

SQL Server on Azure Virtual Machines

SQL Server on Azure Virtual Machines is infrastructure as a service (IaaS). The customer has complete control of the operating system and the instance, including the version and any features of SQL Server. Reasons for this option include a dependency on a specific version, access to the operating system, or features not available in the PaaS products. The customer accepts responsibility for patching, high availability and much of the backup design, although the SQL IaaS Agent extension automates part of this.

Sort into groups

Which Azure SQL product?

Exam skills 2.1.1

Choose the Azure SQL product that each requirement points to.

Log in to try this activity Interactive activities are free with an account.

Open-source relational services

Azure Database for PostgreSQL flexible server and Azure Database for MySQL flexible server are managed services for the community editions of those engines. They suit applications already built on PostgreSQL or MySQL, or a team that wants an open-source engine with managed patching, backups and high availability. Both offer high availability with a standby replica, either in the same zone or in another zone, and both can use read replicas. Migrating an Oracle or SQL Server application to one of these engines generally involves converting schema and code, so it is a modernization project rather than a lift-and-shift.

The term flexible server remains in the product names, and new deployments should use this model. Older references to single server describe an earlier deployment option that should not be used for new designs.

Choosing a service

A practical decision path starts with the existing engine and then asks how much compatibility and control are needed. The following comparison summarizes the three SQL options.

Azure SQL Database
Service modelPaaS, database scope
SQL Server AgentNo (elastic jobs instead)
Cross-database queriesLimited
Operating system accessNo
Patching and backupsMicrosoft
Choose when New cloud applications
SQL Managed Instance
Service modelPaaS, instance scope
SQL Server AgentYes
Cross-database queriesYes
Operating system accessNo
Patching and backupsMicrosoft
Choose when Migration with little change and no OS management
SQL Server on Azure VM
Service modelIaaS
SQL Server AgentYes
Cross-database queriesYes
Operating system accessYes
Patching and backupsCustomer, with automation options
Choose when Full control or unsupported features

The following diagram matches three applications to the Azure SQL option that suits each.

Matching three applications to Azure SQL options. A new multi-tenant app with unpredictable use and no OS management suits Azure SQL Database with elastic pools or serverless. A database depending on linked servers and SQL Server Agent suits SQL Managed Instance. An extended stored procedure needing file system access requires SQL Server on a virtual machine.
The scenario is illustrative.

Reducing licence cost

Two pricing mechanisms frequently appear as qualifiers. Azure Hybrid Benefit applies existing SQL Server licences with Software Assurance to vCore-based Azure SQL services and to SQL Server on virtual machines, removing the licence component of the price. It is not available for new Hyperscale databases, because Hyperscale pricing no longer includes a licence surcharge. Reserved capacity offers a discount in return for a one-year or three-year commitment to vCore compute.

A recovery-only replica may also be cheaper: Azure SQL offers licence-free standby replicas for disaster recovery, which reduces the cost of a passive secondary.

True or false

Licence cost levers

Exam skills 2.1.1

Check how Azure Hybrid Benefit, reservations and free replicas reduce cost.

Log in to try this activity Interactive activities are free with an account.
Worked example

Choosing a database service

A software vendor builds a new multi-tenant web application. It wants no operating system management, and it expects each customer's database to have unpredictable usage. A second team must migrate a 2 TB SQL Server database whose application depends on linked servers and SQL Server Agent. A third application needs a third-party extended stored procedure that requires file system access on the server. Which service suits each?

The new application suits Azure SQL Database, whose elastic pools and serverless compute handle unpredictable use with no operating system to manage. The migrating application suits SQL Managed Instance, which supports linked servers and SQL Server Agent while removing operating system work.

The third application needs file system access, which only SQL Server on an Azure virtual machine provides. Choosing a virtual machine for all three would meet every technical requirement, but it would give the first two teams administrative work that the scenario seeks to avoid.

Check yourself

Which Azure SQL product should be chosen for linked servers without operating system management?

Show answer

SQL Managed Instance, which is PaaS and supports linked servers.

Exam Tips

Remember for the exam

  • SQL Database: database-scoped PaaS. Managed Instance: instance-scoped PaaS. VM: IaaS with full control.
  • SQL Server Agent, linked servers and CLR point to Managed Instance when PaaS is required.
  • Azure Hybrid Benefit needs licences with Software Assurance, and applies to vCore models.
  • Use flexible server for PostgreSQL and MySQL.