Microsoft Certified: Azure Developer Associate (AZ-204)Connect to and consume Azure services and third-party servicesMedium

A company is building a serverless application that needs to perform CPU-intensive image processing tasks. These tasks can take several minutes to complete and should run on demand when an image is uploaded to Azure Blob Storage. However, the company wants to optimize costs by only paying for the compute time used, without provisioning or managing servers. Which Azure Function plan and trigger should be used?

  1. AConsumption Plan with a Blob trigger
  2. BDedicated App Service Plan with a Queue trigger
  3. CDedicated App Service Plan with an HTTP trigger
  4. DPremium Plan with a Timer trigger
Show answer & explanation

Correct answer: A. Consumption Plan with a Blob trigger

The Consumption Plan for Azure Functions is ideal for cost optimization as it bills only for execution time and memory consumed, scaling automatically. A Blob trigger is perfect for reacting to new image uploads. HTTP triggers require an external call, Timer triggers are for scheduled tasks, and Dedicated/Premium plans incur fixed costs, not ideal for on-demand, cost-optimized serverless compute.

Why the other options are wrong

  • B. A Dedicated App Service Plan has fixed costs. A Queue trigger would require an intermediate queue to signal image uploads, adding complexity, rather than directly reacting to the blob event.
  • C. A Dedicated App Service Plan involves fixed costs and server management, which contradicts the 'optimize costs' and 'without provisioning or managing servers' requirements. An HTTP trigger is manual, not automatic for uploads.
  • D. A Premium Plan offers enhanced performance and VNET integration but still has higher base costs than Consumption. A Timer trigger is for scheduled tasks, not on-demand processing of uploads.

Azure Functions Consumption Plan & Blob Trigger

The Azure Functions Consumption Plan is a serverless hosting option that automatically scales and bills only for the resources consumed during function execution. A Blob trigger executes a function when a new or updated blob is detected in Azure Blob Storage.

  • Consumption Plan: Pay-per-execution, automatic scaling, no server management.
  • Blob Trigger: Event-driven by Blob Storage changes (new/updated blobs).
  • Ideal for cost-effective, event-driven processing of files.
  • Functions can be configured for long-running tasks within plan limits.

Memory trick: Consume only when an image triggers; no waste, just smart processing.

More Connect to and consume Azure services and third-party services questions