🔒 Guided

Pre-launch preview. Authorised access only.

Incorrect code

Guided by A Guide to Cloud
Explore AB-900 AI-901
Guided DP-300 Domain 4
Domain 4 — Module 4 of 4 100%
22 of 28 overall

DP-300 Study Guide

Domain 1: Plan and Implement Data Platform Resources

  • Choose Your Azure SQL Platform Free
  • Deploy and Configure Azure SQL Free
  • Scale, Performance, and Compression Free
  • Migration Planning: Online vs Offline Free
  • Execute and Troubleshoot Migrations Free

Domain 2: Implement a Secure Environment

  • Entra Authentication for Azure SQL
  • Security Principals, Permissions, and T-SQL
  • Encryption: TDE, Always Encrypted, and VBS Enclaves
  • Network Security: Firewalls, Private Links, and Endpoints
  • Data Classification and Auditing
  • Data Masking, Ledger, and Row-Level Security

Domain 3: Monitor, Configure, and Optimize Database Resources

  • Performance Baselines and Monitoring Tools
  • Database Watcher and Extended Events
  • Query Store: Configure and Monitor
  • Blocking, DMVs, and Execution Plans
  • Index and Query Optimization
  • Database Maintenance: Indexes, Statistics, and Integrity
  • Automatic Tuning and Performance Settings

Domain 4: Configure and Manage Automation of Tasks

  • Automation Landscape: What Runs Where
  • SQL Server Agent Jobs
  • Deploy with ARM, Bicep, PowerShell, and CLI
  • Elastic Jobs and Azure Automation

Domain 5: Plan and Configure an HA/DR Environment

  • HA/DR Strategy: RPO, RTO, and Architecture
  • Backup and Restore: Strategy and Native Tools
  • Point-in-Time Restore, LTR, and Cloud Backup
  • Geo-Replication and Failover Groups
  • Always On: Availability Groups and FCIs
  • Log Shipping and HA/DR Operations

DP-300 Study Guide

Domain 1: Plan and Implement Data Platform Resources

  • Choose Your Azure SQL Platform Free
  • Deploy and Configure Azure SQL Free
  • Scale, Performance, and Compression Free
  • Migration Planning: Online vs Offline Free
  • Execute and Troubleshoot Migrations Free

Domain 2: Implement a Secure Environment

  • Entra Authentication for Azure SQL
  • Security Principals, Permissions, and T-SQL
  • Encryption: TDE, Always Encrypted, and VBS Enclaves
  • Network Security: Firewalls, Private Links, and Endpoints
  • Data Classification and Auditing
  • Data Masking, Ledger, and Row-Level Security

Domain 3: Monitor, Configure, and Optimize Database Resources

  • Performance Baselines and Monitoring Tools
  • Database Watcher and Extended Events
  • Query Store: Configure and Monitor
  • Blocking, DMVs, and Execution Plans
  • Index and Query Optimization
  • Database Maintenance: Indexes, Statistics, and Integrity
  • Automatic Tuning and Performance Settings

Domain 4: Configure and Manage Automation of Tasks

  • Automation Landscape: What Runs Where
  • SQL Server Agent Jobs
  • Deploy with ARM, Bicep, PowerShell, and CLI
  • Elastic Jobs and Azure Automation

Domain 5: Plan and Configure an HA/DR Environment

  • HA/DR Strategy: RPO, RTO, and Architecture
  • Backup and Restore: Strategy and Native Tools
  • Point-in-Time Restore, LTR, and Cloud Backup
  • Geo-Replication and Failover Groups
  • Always On: Availability Groups and FCIs
  • Log Shipping and HA/DR Operations
Domain 4: Configure and Manage Automation of Tasks Premium ⏱ ~13 min read

Elastic Jobs and Azure Automation

Create and configure elastic jobs for multi-database T-SQL execution. Use Azure Automation runbooks for resource management. Configure alerts and troubleshoot.

Multi-database automation

☕ Simple explanation

Elastic jobs are like sending a memo to every office branch — one command, executed across many databases. “Run this index maintenance on all 30 tenant databases.” Done.

Azure Automation is like a virtual assistant that manages your Azure resources — “Scale up the database at 8 AM, scale down at 8 PM, email me if anything fails.” It runs PowerShell scripts on a schedule.

Elastic jobs execute T-SQL against one or many Azure SQL databases. They replace SQL Server Agent for multi-database scenarios on Azure SQL Database (where Agent doesn’t exist). Azure Automation runs PowerShell or Python runbooks to manage Azure resources and orchestrate workflows.

Elastic jobs

Architecture

ComponentPurpose
Job agentAzure resource that hosts and executes jobs
Job databaseAzure SQL DB that stores job definitions, history, and state
Target groupSet of databases where the job runs (individual DBs, elastic pool, server, custom list)
JobCollection of steps (T-SQL) to execute
Job executionA single run of the job against the target group

Setting up elastic jobs

# 1. Create a job agent (Azure CLI)
az sql elastic-job agent create \
  --resource-group ScaleWaveRG \
  --server scalewave-sql \
  --name scalewave-job-agent \
  --database-name JobDB

# 2. Create credentials for target databases
az sql elastic-job credential create \
  --resource-group ScaleWaveRG \
  --server scalewave-sql \
  --agent-name scalewave-job-agent \
  --name job-cred \
  --username jobuser \
  --password <secure>

Creating and running a job

-- Connect to the job database
-- Create a target group (all databases in the elastic pool)
EXEC jobs.sp_add_target_group 'TenantDatabases';
EXEC jobs.sp_add_target_group_member 'TenantDatabases',
    @target_type = 'SqlElasticPool',
    @server_name = 'scalewave-sql.database.windows.net',
    @elastic_pool_name = 'TenantPool';

-- Create a job
EXEC jobs.sp_add_job @job_name = 'NightlyIndexMaintenance';

-- Add a step
EXEC jobs.sp_add_jobstep @job_name = 'NightlyIndexMaintenance',
    @step_name = 'RebuildFragmentedIndexes',
    @command = N'ALTER INDEX ALL ON dbo.Orders REBUILD WITH (ONLINE = ON);',
    @credential_name = 'job-cred',
    @target_group_name = 'TenantDatabases';

-- Execute immediately
EXEC jobs.sp_start_job 'NightlyIndexMaintenance';

-- Check execution status
SELECT * FROM jobs.job_executions
WHERE job_name = 'NightlyIndexMaintenance'
ORDER BY start_time DESC;

Scheduling elastic jobs

Elastic jobs support cron-style scheduling or one-time execution. Schedule via the Azure portal, PowerShell, or T-SQL stored procedures.

Azure Automation

Runbooks for database management

# Example: Scale database based on time of day
$resourceGroup = "ScaleWaveRG"
$serverName = "scalewave-sql"
$databaseName = "ProductionDB"

$hour = (Get-Date).Hour

if ($hour -ge 8 -and $hour -lt 18) {
    # Business hours: scale up
    Set-AzSqlDatabase -ResourceGroupName $resourceGroup `
        -ServerName $serverName -DatabaseName $databaseName `
        -Edition "GeneralPurpose" -Vcore 8 -ComputeGeneration "Gen5"
    Write-Output "Scaled up to 8 vCores"
} else {
    # Off-hours: scale down
    Set-AzSqlDatabase -ResourceGroupName $resourceGroup `
        -ServerName $serverName -DatabaseName $databaseName `
        -Edition "GeneralPurpose" -Vcore 2 -ComputeGeneration "Gen5"
    Write-Output "Scaled down to 2 vCores"
}

Azure Automation components

ComponentPurpose
Automation accountContainer for runbooks, schedules, credentials
RunbookPowerShell or Python script
ScheduleWhen to run (recurring or one-time)
CredentialStored credentials for authentication
Managed identityRecommended auth method (no secrets)
WebhookHTTP endpoint to trigger a runbook externally

Alerts and notifications for automated tasks

ToolAlert MethodHow
Elastic jobsQuery job_executions table; set Azure Monitor alert on failuresMonitor the job database for failed executions
Azure AutomationBuilt-in job status tracking + Azure Monitor alertsAlert on runbook failure status
SQL AgentOperators + Database MailConfigure notifications on job success/failure
Azure MonitorAlert rules on metrics and logsEmail, SMS, webhook, Logic App actions

Troubleshooting

IssueToolWhere to Look
Elastic job fails on specific databasesJob databaseSELECT * FROM jobs.job_executions WHERE lifecycle = 'Failed'
Job credential rejectedTarget databaseCheck the login/user exists on the target with needed permissions
Runbook times outAzure AutomationCheck runbook job output; increase Fair Share timeout or split runbook
Runbook can’t authenticateAutomation accountVerify managed identity is enabled and has RBAC on target resources
Question

What is an elastic job agent?

Click or press Enter to reveal answer

Answer

An Azure resource that hosts and executes elastic jobs. It requires a dedicated Azure SQL Database as its job database (stores definitions, history, and state).

Click to flip back

Question

How does Azure Automation authenticate to Azure SQL resources?

Click or press Enter to reveal answer

Answer

Recommended: managed identity assigned to the Automation account with appropriate RBAC roles. Alternative: stored credentials (service principal) in the Automation account.

Click to flip back

Question

Where do you check elastic job execution results?

Click or press Enter to reveal answer

Answer

Query the jobs.job_executions view in the job database. It shows status (Succeeded, Failed, InProgress), start/end times, and per-database results.

Click to flip back

Knowledge Check

Priya's elastic job fails on 3 out of 30 target databases with 'Login failed for user jobuser.' The other 27 succeed. What should she check?

🎬 Video coming soon

You’ve completed Domain 4! You can now automate database tasks across all Azure SQL platforms.

Next up: HA/DR Strategy: RPO, RTO, and Architecture — plan high availability and disaster recovery for Azure SQL solutions.

← Previous

Deploy with ARM, Bicep, PowerShell, and CLI

Next →

HA/DR Strategy: RPO, RTO, and Architecture

Guided

I learn, I simplify, I share.

A Guide to Cloud YouTube Feedback

© 2026 Sutheesh. All rights reserved.

Guided is an independent study resource and is not affiliated with, endorsed by, or officially connected to Microsoft. Microsoft, Azure, and related trademarks are property of Microsoft Corporation. Always verify information against Microsoft Learn.