DP-300 Configure and manage automation of tasks Practice Question
You are automating index maintenance for an Azure SQL Database using an Azure Automation runbook. The runbook connects to the database and executes T-SQL to rebuild fragmented indexes. You need to ensure the runbook can authenticate without storing credentials in the script. What should you configure?
⚠ Common exam trap
The trap here is believing that storing credentials in Azure Key Vault or Automation variables fully satisfies the requirement, but those still involve managing secrets, whereas a managed identity eliminates them.
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
✓
A managed identity for the Automation account with a contained database user in the target database
The most secure and streamlined method for an Azure Automation runbook to authenticate to Azure SQL Database without storing credentials is to use a managed identity. The Automation account's managed identity is registered in Microsoft Entra ID, and you create a contained database user in the target database for that identity. The runbook then connects using Microsoft Entra ID authentication, eliminating secrets. This is the recommended practice for automation.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
A service principal with a client secret stored in the Automation account certificates
Why it's wrong here
A service principal with a client secret is a valid way to authenticate to Azure, but the secret must be stored and managed, potentially in the Automation account certificates. This still involves a credential that must be protected and rotated. It is more complex than using a managed identity, which eliminates secret management entirely. Therefore, it does not fully meet the goal of not storing credentials in the script.
- ✓
A managed identity for the Automation account with a contained database user in the target database
Why this is correct
A managed identity for the Automation account allows the runbook to authenticate to Azure SQL Database without embedding credentials. You create a contained database user mapped to the managed identity and grant necessary permissions. This approach eliminates secret management and is the recommended secure method for Azure services to access databases. The runbook can use the identity to obtain a token and connect using Microsoft Entra ID authentication.
- ✗
A SQL login with a strong password stored in an Automation variable
Why it's wrong here
Storing a password in an Automation variable, even if encrypted, still requires managing and rotating that secret. It introduces a credential that could be exposed and is not the most secure method. The scenario explicitly requires not storing credentials in the script, but a variable is still a stored credential. This approach also lacks the benefits of Microsoft Entra ID integration and centralized identity management.
- ✗
Azure Key Vault to store the SQL admin credentials, retrieved by the runbook at runtime
Why it's wrong here
Using Key Vault improves security over plain variables, but the runbook still needs to authenticate to Key Vault and retrieve the secret, which adds complexity. It also still relies on a SQL login, which is less secure than a managed identity. The requirement is to avoid storing credentials in the script; while Key Vault does that, it does not eliminate the need for a credential entirely, making it a less optimal solution.
Go deeper
Related to this question
Learn chapter
Configuring Automation Tasks for Database Administration
Key term
Azure SQL Authentication
Azure SQL Authentication is the process of verifying a user's identity to access an Azure SQL database using either a username and password (SQL Authentication) or a Microsoft Entra ID (formerly Azure AD) identity.
Key term
Azure SQL Performance Tuning
Azure SQL Performance Tuning is the process of optimizing the speed and efficiency of queries and database operations in Microsoft Azure SQL Database or SQL Managed Instance to reduce latency and improve throughput.
About these practice questions
This DP-300 question is part of Courseiva's 574-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Microsoft exam blueprint
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.