Courseiva

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

    -OutputAs controls how Invoke-Sqlcmd renders result sets, not whether comparison logic executes; the script already runs successfully, so output formatting is not suppressing the alert. That parameter matters when piping query results into downstream formatting or export steps, not for evaluating a DTU threshold.

  • ✓

    The script uses Out-GridView, which is not supported in Azure Automation.

    Why this is correct

    Out-GridView requires an interactive desktop session to render its graphical window, and Azure Automation runbooks execute headlessly in a sandbox with no GUI. The cmdlet therefore fails silently or blocks, so the DTU threshold comparison never completes and no alert fires, satisfying the stem's non-interactive constraint.

  • ✗

    The Invoke-SqlCmd cmdlet is not compatible with Azure SQL Database.

    Why it's wrong here

    Invoke-SqlCmd connects to Azure SQL Database provided the firewall permits the runbook's outbound address; the script runs successfully, so connectivity and the cmdlet clearly work. Incompatibility would produce a connection failure, not silent success. The cmdlet is the right tool when querying Azure SQL from Automation.

  • ✗

    The query syntax is incorrect for Azure SQL Database.

    Why it's wrong here

    The script runs successfully, so its T-SQL parses and executes against Azure SQL Database; incorrect query syntax would surface as a runtime error, not silent success. Syntax errors are the likely cause when a runbook fails outright, but here the alert logic itself never fires.

About these practice questions

Courseiva writes every DP-300 question from scratch — 574 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.