DP-300 Configure and manage automation of tasks Practice Question
Exhibit
Refer to the exhibit. ``` Invoke-SqlCmd -ServerInstance 'myserver.database.windows.net' -Database 'mydb' -Query "SELECT * FROM sys.dm_db_resource_stats" -Credential $cred | Out-GridView ```
You are reviewing a PowerShell script that is part of an Azure Automation runbook. The script is intended to monitor resource usage of an Azure SQL Database and trigger an alert if DTU usage exceeds 80%. The script runs successfully but does not trigger the alert. What is the most likely reason?
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
✓
The script uses Out-GridView, which is not supported in Azure Automation.
In Azure Automation runbooks, there is no interactive desktop environment, so cmdlets that require a graphical user interface, such as Out-GridView, are not supported. When the script runs in a runbook, Out-GridView fails silently or does not produce any output, causing the subsequent alert logic (which likely depends on the output) to never trigger. Option A is incorrect because the -OutputAs parameter is used with Invoke-SqlCmd to specify the output format, not to return results for alerting. Option C is incorrect because Invoke-SqlCmd is fully compatible with Azure SQL Database when proper authentication is used. Option D is incorrect because the script runs successfully, indicating the query syntax is valid.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The script must use the -OutputAs parameter to return results.
Why it's wrong here
The issue is not with output format but with Out-GridView.
- ✓
The script uses Out-GridView, which is not supported in Azure Automation.
Why this is correct
Out-GridView requires an interactive session and does not work in Azure Automation runbooks.
- ✗
The Invoke-SqlCmd cmdlet is not compatible with Azure SQL Database.
Why it's wrong here
Invoke-SqlCmd works with Azure SQL Database.
- ✗
The query syntax is incorrect for Azure SQL Database.
Why it's wrong here
The query is valid for Azure SQL Database.
Go deeper
Related to this question
Learn chapter
Overview of Azure Data Platform Options
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
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 →
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.