AZ-204 Develop Azure compute solutions Practice Question
You need to execute a PowerShell script every night to clean up unused resources in your Azure subscription. The script should run with a specific service principal identity that has the necessary permissions. You want a serverless solution with minimal management overhead. Which Azure service should you use?
⚠ Common exam trap
It's easy for candidates to choose Azure Functions (Option A) because it is a popular serverless compute option, but they overlook that Azure Automation is the dedicated service for scheduled PowerShell administration in Azure, with built-in identity management and longer execution time limits.
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
✓
Azure Automation with a scheduled runbook.
Azure Automation with a scheduled runbook is the correct choice because it is designed specifically for running PowerShell scripts on a recurring schedule using a service principal identity, with built-in support for Azure authentication via managed identities or Run As accounts. This provides a serverless solution with minimal management overhead, as Azure Automation handles the scheduling, execution, and identity management without requiring you to maintain any infrastructure.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Azure Functions with a timer trigger running PowerShell.
Why it's wrong here
Azure Functions can indeed execute PowerShell scripts via a timer trigger and is a serverless compute service, making it tempting for scheduled tasks. However, for executing PowerShell scripts with minimal management overhead, it requires managing the PowerShell runtime environment and module dependencies within the function app. This adds a layer of configuration compared to services specifically designed for scheduled PowerShell automation. Azure Functions are ideal for event-driven execution of custom code in languages like C# or Python, where specific application logic responds to various triggers.
- ✓
Azure Automation with a scheduled runbook.
Why this is correct
Azure Automation is purpose-built for executing PowerShell scripts (runbooks) on a schedule without managing underlying infrastructure. It natively supports PowerShell, allowing you to upload scripts, define schedules, and use Managed Identities or Run As accounts for secure authentication to Azure resources. This provides a truly serverless and low-management solution ideal for routine administrative tasks like nightly cleanup scripts.
- ✗
Azure Logic Apps with a recurrence trigger running a PowerShell action.
Why it's wrong here
Azure Logic Apps are designed for orchestrating workflows and integrating various services, not for natively executing PowerShell scripts. While a recurrence trigger can initiate a workflow, there isn't a direct "run PowerShell script" action within Logic Apps. To achieve this, you would typically invoke an Azure Automation runbook from within Logic Apps, introducing an additional layer of complexity and cost that is unnecessary for a straightforward scheduled script execution.
- ✗
Set up a scheduled task on an Azure VM to run the script.
Why it's wrong here
Setting up a scheduled task on an Azure Virtual Machine (VM) would indeed execute a PowerShell script on a schedule. However, this approach directly contradicts the principle of serverless computing and minimal management. It necessitates provisioning, maintaining, patching, and securing an entire VM, incurring continuous operational costs and significant administrative overhead that is entirely avoidable with serverless alternatives.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
About these practice questions
Courseiva writes every AZ-204 question from scratch — 881 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 AZ-204 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 AZ-204 exam.