Skip to main content

Automation Decision Matrix

This page is your quick reference for choosing the right automation tool for any DBA task across all Azure SQL platforms.

The Decision Matrix

TaskSQL on VMSQL MIAzure SQL DBRecommended Tool
Index maintenanceSQL AgentSQL AgentElastic JobsT-SQL-based scheduling
Statistics updateSQL AgentSQL AgentElastic JobsT-SQL-based scheduling
DBCC CHECKDBSQL AgentSQL AgentN/A (PaaS)SQL Agent
Backup managementSQL AgentAutomatedAutomatedPlatform-managed for PaaS
Schema deploymentAzure DevOpsAzure DevOpsAzure DevOpsCI/CD pipeline + DACPAC
Scale vCoresN/A (VM resize)Automation RunbookAutomation RunbookPowerShell w/ Managed Identity
Failover testingSQL AgentAutomation RunbookAutomation RunbookScheduled failover script
Send alertsDatabase MailAzure MonitorAzure MonitorPlatform alerting
Cross-DB T-SQLMulti-server adminLinked ServersElastic JobsPer-platform best tool
Compliance checksAutomation RunbookAutomation RunbookAutomation RunbookPowerShell scanning
Report generationSSIS / SQL AgentADF / AutomationADF / AutomationCloud-native ETL
Workflow orchestrationSSISLogic AppsLogic AppsVisual workflow designer
Custom code automationTask SchedulerAzure FunctionsAzure FunctionsTimer-triggered functions

Platform Availability Quick Reference

ToolSQL on VMSQL MIAzure SQL DB
SQL Server Agent✅ Full✅ T-SQL only
Elastic Jobs
Azure Automation
Logic Apps
Azure Functions
Azure DevOps
Bicep / ARM
Database Mail

Decision Flowchart (Text)

What do you need to automate?

  1. T-SQL on a single database?

    • VM/MI → SQL Agent job
    • SQL DB → Elastic Job (or Azure Automation with Invoke-Sqlcmd)
  2. T-SQL across multiple databases?

    • SQL DB → Elastic Jobs with target group
    • VM → Multi-server administration
    • MI → SQL Agent on each MI (no cross-MI jobs)
  3. PowerShell / Azure resource management?

    • All platforms → Azure Automation Runbook with Managed Identity
  4. Complex workflow with multiple services?

    • All platforms → Logic Apps (visual) or Azure Functions (code)
  5. Infrastructure deployment?

    • All platforms → Bicep + Azure DevOps/GitHub Actions pipeline
  6. Schema changes?

    • All platforms → SSDT + DACPAC + CI/CD pipeline

Cost Comparison

ToolCost ModelMonthly Estimate (typical DBA use)
SQL AgentIncluded with SQL license$0
Elastic JobsJob agent + S1 job DB~$30-50/month
Azure Automation500 free min/month, then per-min~$0-10/month
Logic Apps (Consumption)Per action (~$0.000125/action)~$1-5/month
Azure Functions (Consumption)1M free executions/month~$0/month
Azure DevOpsFree tier (1 agent, 1800 min/month)$0
🏢 Real-World DBA Note

Cost-effective pattern for most DBAs: SQL Agent for VM/MI jobs (free), Azure Automation for PowerShell (500 free min), Azure Monitor alerts (basic metrics free), Azure DevOps free tier for CI/CD. Total additional cost: ~$0-10/month.

Migration Path: On-Prem → Cloud Automation

On-Prem ToolCloud Equivalent
SQL Agent (on-prem)SQL Agent (VM/MI) or Elastic Jobs (SQL DB)
Windows Task SchedulerAzure Automation or Azure Functions
SSISAzure Data Factory SSIS IR or ADF pipelines
PowerShell scriptsAzure Automation Runbooks
cron jobs (Linux)Azure Functions Timer Trigger
Nagios / Zabbix alertsAzure Monitor + Action Groups
ServiceNow integrationAzure Monitor → ITSM connector
🎯 Exam Focus

DP-300 commonly tests: "Which automation tool for Azure SQL Database?" → Elastic Jobs for T-SQL, Azure Automation for PowerShell. "Which for MI?" → SQL Agent (T-SQL only) + Azure Automation. "Which for VM?" → SQL Agent (full) + Azure Automation.


Anti-Patterns

  • "Use Azure Automation for everything because it's centralized." Job-control state lives outside SQL. SQL Agent on MI/VM has native job history in msdb, retry semantics tied to T-SQL errors, and zero auth hop. Don't trade native ergonomics for centralization unless you actually need cross-resource orchestration.
  • "Replace SQL Agent with Logic Apps." Logic Apps charges per action. A nightly index-rebuild loop with 200 tables = 200 actions × 365 days. SQL Agent on MI is free with the license. Pick Logic Apps only when the workflow spans services (Teams notify, ServiceNow ticket, blob copy).
  • "Elastic Jobs is a drop-in for SQL Agent on SQL DB." No CLR, no SSIS step type, no PowerShell step, no email step (use Action Groups instead), and the job DB is a separate billable Azure SQL DB. Plan for the rewrite, not a port.
  • "Functions Timer Trigger for DBA tasks." Functions are stateless and tuned for short execution. A 4-hour CHECKDB on a multi-TB DB will hit the consumption-plan timeout. Use Premium plan or, better, SQL Agent / Azure Automation.
  • "One Automation account for the whole org." Runbook concurrency is per-account. A single noisy job stalls the rest. Split by environment (prod / non-prod) at minimum.
⚠️ Watch Out

Azure Automation has 500 free runtime minutes per subscription per month. After that, billing is per-minute. A runbook that polls every 5 minutes burns the free quota in 1.7 days. Use webhooks or schedules with longer intervals, not poll loops.


Migration Between Automation Tools

From → ToPathCost
SQL Agent (on-prem) → SQL Agent (MI)Script jobs from msdb; deploy on MIAlmost line-for-line; some steps (CmdExec, SSIS) need rewrite
SQL Agent (on-prem) → Elastic JobsConvert each step to T-SQL; create Job DB; re-author scheduleStep-by-step rewrite; lose CLR/PowerShell steps
SQL Agent → Azure AutomationWrap T-SQL in PowerShell using Invoke-Sqlcmd; managed identity for authAuth + retry logic to add; gain cross-service orchestration
Task Scheduler → Azure AutomationPort PowerShell as-is into a runbook; use a Hybrid Worker if on-prem dependenciesHybrid Worker = VM + agent; otherwise free for first 500 min/mo
Cron → Functions Timer TriggerRewrite as function; pin runtime versionCold-start risk; switch to Premium plan if predictable latency matters
Azure Automation → GitHub Actions / Azure DevOps PipelinesMove runbook to YAML pipeline; use OIDC federation for authGain CI/CD ergonomics; lose webhook + watcher patterns

The expensive moves are SQL Agent → Elastic Jobs (rewrite) and on-prem → Hybrid Worker (infra). Everything else is mostly script porting.


Real Scenarios

  1. MI with 40 maintenance jobs from on-prem SQL 2019SQL Agent on MI, scripted from msdb. Driver: 90 % work line-for-line. Trade-off: 3 jobs using CmdExec rewritten as Azure Automation runbooks.
  2. Azure SQL DB SaaS, per-tenant index maintenanceElastic Jobs targeting a tenant group. Driver: only T-SQL, runs across hundreds of DBs in one job. Trade-off: extra Azure SQL DB for the job control DB (~ S0 ≈ $15/mo).
  3. Cross-cloud sync (S3 → Azure Blob → SQL DB ingest)Azure Data Factory pipeline + SQL stored procedure activity. Driver: visual orchestration + connectors. Trade-off: ADF pricing model (per-pipeline-run + per-activity).
  4. Alert pipeline: SQL fires error → Teams notify + ServiceNow ticketAzure Monitor alert → Action Group → Logic App. Driver: native ITSM connectors. Trade-off: Logic Apps actions billed; keep workflow short.
  5. Daily backup verification across 200 SQL VMsAzure Automation runbook with PowerShell DSC + managed identity. Driver: cross-VM, cross-subscription scope, scheduled centrally. Trade-off: auth setup with managed identity is the longest part of the build.

Flashcards

What automation tool replaces SQL Agent for Azure SQL Database?
Click to reveal answer
Elastic Jobs for T-SQL scheduling, Azure Automation for PowerShell. SQL Agent is not available on Azure SQL DB.
1 / 5

Quiz

Q1/5
0 correct
A customer has 100 Azure SQL databases and needs to run weekly index maintenance T-SQL across all of them. What should they use?