Domain 4 β€” Module 1 of 4 25%
19 of 28 overall
Domain 4: Configure and Manage Automation of Tasks Free ⏱ ~10 min read

Automation Landscape: What Runs Where

Understand the automation tools available for Azure SQL β€” SQL Agent, elastic jobs, Azure Automation, and Infrastructure as Code. Know which tool fits each platform.

The automation decision matrix

Simple explanation

Think of automation like hiring help for different jobs:

SQL Server Agent is your on-site building manager β€” lives inside the SQL Server, runs scheduled T-SQL jobs, sends alerts. Only available on MI and VMs.

Elastic jobs are the district manager β€” one controller that runs T-SQL across MANY Azure SQL databases. Perfect for multi-database maintenance.

Azure Automation is the corporate operations team β€” runs PowerShell runbooks to manage Azure resources (scale DBs, start/stop VMs, orchestrate workflows).

IaC (ARM/Bicep/CLI) is the architect’s blueprint β€” defines what resources should exist and deploys them consistently.

Which tool for which platform?

Automation Tool Availability
ToolSQL DatabaseManaged InstanceSQL on VMs
SQL Server AgentNoYesYes
Elastic jobsYes (target)Yes (target)No
Azure Automation (runbooks)Yes (manage resources)Yes (manage resources)Yes (manage resources)
ARM / Bicep templatesYes (deploy/configure)Yes (deploy/configure)Yes (deploy/configure)
Azure PowerShell / CLIYesYesYes
Logic Apps (scheduled)YesYesYes

Decision matrix: which tool for the task?

TaskBest ToolWhy
Run T-SQL maintenance on a single MI/VM databaseSQL Server AgentBuilt-in scheduler, lives on the instance
Run the same T-SQL across 50 Azure SQL databasesElastic jobsDesigned for multi-database T-SQL execution
Scale a database up during business hours, down at nightAzure Automation + runbookPowerShell manages Azure resources on a schedule
Deploy 10 identical databases across regionsBicep / ARM templateDeclarative IaC, idempotent, version-controlled
Orchestrate a complex workflow (backup + validate + notify)Azure Automation or Logic AppsMulti-step workflow orchestration
Monitor and alert on database metricsAzure Monitor alertsNot automation per se, but triggers actions
Exam tip: SQL Agent is NOT on SQL Database

This is a high-frequency exam question. SQL Server Agent is a Windows service that runs on the SQL Server instance. Azure SQL Database is a PaaS service with no instance-level access β†’ no Agent.

If the scenario says β€œAzure SQL Database” and needs scheduled T-SQL jobs, the answer is elastic jobs, NOT Agent. If the scenario says β€œManaged Instance” or β€œSQL on VMs”, SQL Server Agent is available.

Kenji’s automation strategy at NorthStar:

  • SQL Agent on MI: nightly index maintenance, weekly CHECKDB, statistics updates
  • Elastic jobs: monthly data purge across 15 reporting databases
  • Azure Automation: Auto-scale MI vCores before month-end processing
  • Bicep templates: Deploy new MI instances for test environments
Question

Can SQL Server Agent run on Azure SQL Database?

Click or press Enter to reveal answer

Answer

No. SQL Server Agent is only available on Azure SQL Managed Instance and SQL Server on Azure VMs. For scheduled jobs on Azure SQL Database, use elastic jobs.

Click to flip back

Question

What is the best tool for running the same T-SQL script across 50 Azure SQL databases?

Click or press Enter to reveal answer

Answer

Elastic jobs. They're designed for multi-database T-SQL execution. Create one job, define multiple target databases, schedule it.

Click to flip back

Question

What is Azure Automation best used for in the context of Azure SQL?

Click or press Enter to reveal answer

Answer

Managing Azure resources via PowerShell runbooks β€” scaling databases, starting/stopping VMs, orchestrating multi-step workflows. It manages the Azure platform, not the SQL engine directly.

Click to flip back

Knowledge Check

Priya needs to run a nightly index maintenance script across all 30 tenant databases in Azure SQL Database (not MI). Which tool should she use?

Next up: SQL Server Agent Jobs β€” create and manage scheduled jobs with alerts and notifications.