Microsoft Certified: Azure Developer Associate (AZ-204)Connect to and consume Azure services and third-party servicesEasy
A company is developing an Azure Function App that processes images uploaded to Azure Blob Storage. The function needs to be triggered whenever a new image (JPG or PNG) is added to a specific container. The solution must minimize costs and ensure that the function is only active when new images arrive. Which trigger type should the Azure Function use?
- AQueue Trigger
- BBlob Trigger
- CHTTP Trigger
- DTimer Trigger
Show answer & explanationAnswer & explanation
Correct answer: B. Blob Trigger
An Azure Blob Trigger is specifically designed to execute an Azure Function whenever a new or updated blob is detected in a specified container. This aligns perfectly with the requirement to process images upon upload, minimizing costs by only running when needed.
Why the other options are wrong
- A. A Queue Trigger responds to messages added to an Azure Storage Queue, not directly to blob uploads.
- C. An HTTP Trigger responds to HTTP requests and wouldn't automatically detect blob uploads.
- D. A Timer Trigger executes on a schedule, not in response to blob uploads.
Azure Function Blob Trigger
An Azure Function trigger that runs code in response to new or modified blobs in Azure Storage.
- Automatically invoked when a blob is created or updated.
- Supports binding to input and output blobs.
- Cost-effective for event-driven storage processing.
Memory trick: Triggers are the starting gun for your Azure Functions.