Elastic Jobs


SQL Agent Jobs
Azure Automation Service
Elastic Jobs
Automated Tuning
Automated Patching
Start course
1h 1m

Whether you’re running SQL Server on-premise, in a VM, on a managed instance, or using Azure SQL, there is maintenance to be performed and other tasks that need to be executed on a regular basis. In this course, we will look at the options available to you in these various environments for automating maintenance and regularly repeated tasks.

SQL Server has a long history of task automation through SQL Server agent, not only will we see how to use it but also how it’s been adapted to carry out maintenance tasks, and how similar functionality has made it into Azure services. From mundane single-database scheduled backups through to task and performance automation across multiple servers, this course looks at on-premise and in-cloud options.

If you have any feedback relating to this course, feel free to contact us at support@cloudacademy.com.

Learning Objectives

  • Maintain your databases and data through the use of maintenance plans and the SQL Server Maintenance Wizard
  • Use SQL Agent Jobs to automate maintenance tasks
  • Automate maintenance across multiple SQL servers
  • Set up rules to enforce policies
  • Back up your SQL Server instances using Azure Recovery Services Vault
  • Learn about the Azure Automation Service and how it can be used
  • Use Elastic Jobs to schedule tasks within the context of databases
  • Manage database performance with Automated Tuning
  • Manage database updates with Automated Patching

Intended Audience

  • Data engineers
  • Database engineers
  • IT professionals or anyone looking to learn about automating tasks in Azure SQL and SQL server


To get the most out of this course, you should have experience with SQL Server Management Studio, be familiar with reading and writing SQL, and have an understanding of basic database architecture and administration tasks, like indexes and backups.


Course Related SQL Scripts



As we've seen with scheduled jobs on SQL Server, it's very flexible and allows a DBA or developer a lot of freedom. Sure. There is your automation, but it's not the same, and for many coming from an SQL environment perhaps not intuitive enough and outside their comfort zone. This perceived lack of equivalent functionality on Azure, has been a pain point for those moving from an on-premise experience. With that in mind, Microsoft has released elastic jobs to enable similar generic job scheduling, but within the context of databases.

At this time holistic job agent service is in preview. And while it can tag at any SQL database except managed instances, it can only be hosted on databases that our service level S0 or above. The elastic job agent service is database driven with tables and stored procedures that are hosted within a database.

From that host database, the service can target multiple Azure SQL servers and databases that are part of a target group. This means a job is defined within the context of a target group and can be applied to all database targets within the group. An elastic job needs credentials to operate. One credential called the refresh or master credential is used for logging on to the target server and querying the master database.

A job credential is needed to execute the steps or actions within a job. You could think of it as analogous to selecting run as within an SQL server job agent. These credentials must exist both on the target and the host server. The job and refreshed credentials can be the same or they can be different. And you could have a separate credential for every step of a job, or they could all be the same credential.

Next, let's look at creating an elastic job. By default, all databases on a server become target databases, and those you don't want to tag it, need to be explicitly excluded.

About the Author
Learning Paths

Hallam is a software architect with over 20 years experience across a wide range of industries. He began his software career as a  Delphi/Interbase disciple but changed his allegiance to Microsoft with its deep and broad ecosystem. While Hallam has designed and crafted custom software utilizing web, mobile and desktop technologies, good quality reliable data is the key to a successful solution. The challenge of quickly turning data into useful information for digestion by humans and machines has led Hallam to specialize in database design and process automation. Showing customers how leverage new technology to change and improve their business processes is one of the key drivers keeping Hallam coming back to the keyboard.