Courseiva
Configure and manage automation of tasksmediumMultiple ChoiceObjective-mapped

DP-300 Configure and manage automation of tasks Practice Question

You are a senior database administrator for a financial services company that uses Azure SQL Managed Instance to host multiple customer databases. The company has a requirement to automatically execute a series of compliance scripts every Sunday at 2:00 AM against all databases in the instance. The scripts include checking for orphaned users, verifying data encryption, and auditing login attempts. The solution must log the execution results in a central table and send an email summary to the compliance team. You have been asked to implement this automation using built-in Azure features without relying on external tools like Power Automate or custom schedulers. What should you use?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Create a SQL Agent job that runs a T-SQL script using sp_foreachdb to execute the compliance scripts on each database, store results in a central database, and send an email using Database Mail.

SQL Agent jobs in Azure SQL Managed Instance can execute T-SQL scripts across databases using sp_foreachdb (or a cursor-based loop) to run compliance scripts on each database. Results can be inserted into a central database using three-part names (or cross-database queries). Email notifications can be sent using Database Mail (sp_send_dbmail). Option A is incorrect because Logic Apps are external tools and not built-in Azure features for this purpose. Option B is incorrect because Azure Automation Runbooks require external connectivity and are not directly integrated with SQL Managed Instance for cross-database execution. Option D is incorrect because Elastic Jobs are designed for Azure SQL Database, not for SQL Managed Instance.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Schedule a Logic App that connects to each database via the SQL connector and runs the scripts.

    Why it's wrong here

    Logic Apps are external and not a built-in Managed Instance feature.

  • Use Azure Automation Runbooks with the PowerShell module for SQL Server to execute scripts on each database.

    Why it's wrong here

    Runbooks are external and require network connectivity; they can run scripts but are not the simplest built-in solution.

  • Create a SQL Agent job that runs a T-SQL script using sp_foreachdb to execute the compliance scripts on each database, store results in a central database, and send an email using Database Mail.

    Why this is correct

    SQL Agent is built-in and supports cross-database execution and email.

  • Create an Elastic Job agent with a job that runs the scripts against each database and logs results to a central database.

    Why it's wrong here

    Elastic jobs are for Azure SQL Database, not Managed Instance.

Go deeper

Related to this question

About these practice questions

Courseiva writes every DP-300 question from scratch — 906 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DP-300 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DP-300 exam.