Bird
Raised Fist0
Azurecloud~10 mins

Trigger types (HTTP, Timer, Blob, Queue) in Azure - Step-by-Step Execution

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Process Flow - Trigger types (HTTP, Timer, Blob, Queue)
Event Occurs
↓
Trigger Type?
↓
Run Function with Event Data
↓
Function Executes
↓
Output or Side Effect
When an event happens, Azure Functions check the trigger type (HTTP, Timer, Blob, or Queue) and run the function with the event data.
Execution Sample
Azure
Trigger: HTTP
Request: GET /api/hello
Function: Returns 'Hello World!'
This function runs when an HTTP GET request is received and returns a greeting.
Process Table
StepTrigger TypeEventFunction ActionOutput
1HTTPGET /api/helloFunction runs with HTTP request dataReturns 'Hello World!'
2TimerTimer fires at 12:00Function runs on scheduleLogs 'Timer triggered'
3BlobNew blob uploaded 'image.png'Function runs with blob dataProcesses and stores metadata
4QueueMessage added to queueFunction runs with queue messageProcesses message and deletes it
5---No event, no function run
💡 Execution stops when no trigger event occurs.
Status Tracker
VariableStartAfter HTTPAfter TimerAfter BlobAfter QueueFinal
Trigger EventNoneHTTP RequestTimer EventBlob UploadQueue MessageNone
Function StateIdleRunningRunningRunningRunningIdle
OutputNone'Hello World!''Timer triggered'Metadata storedMessage processedNone
Key Moments - 3 Insights
Why does the function run only when a trigger event happens?
Because Azure Functions are event-driven, they stay idle until a trigger event occurs, as shown in execution_table rows 1-4. Row 5 shows no event means no run.
How does the function know what data to use for each trigger?
Each trigger type passes specific event data to the function, like HTTP request info, timer schedule, blob content, or queue message, as seen in the 'Event' and 'Function Action' columns in the execution_table.
Can multiple trigger types run the same function?
Yes, but each trigger event runs the function separately with its own data, shown by different rows in the execution_table where the function runs for HTTP, Timer, Blob, and Queue triggers.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what output does the function produce when a new blob is uploaded?
A'Hello World!'
B'Timer triggered'
CProcesses and stores metadata
DProcesses message and deletes it
💡 Hint
Check the row where Trigger Type is 'Blob' in the execution_table.
At which step does the function run because of a timer event?
AStep 1
BStep 2
CStep 3
DStep 4
💡 Hint
Look for 'Timer' in the Trigger Type column of the execution_table.
If no event occurs, what is the function state according to variable_tracker?
AIdle
BError
CRunning
DPaused
💡 Hint
Check the 'Function State' row under 'Final' column in variable_tracker.
Concept Snapshot
Azure Functions run when triggered by events.
Common triggers: HTTP request, Timer schedule, Blob storage change, Queue message.
Each trigger passes event data to the function.
Function runs only when triggered, otherwise idle.
Outputs depend on trigger and function logic.
Full Transcript
Azure Functions use triggers to start running. When an event happens, like an HTTP request, a timer firing, a new blob uploaded, or a message added to a queue, the function runs with data from that event. The function stays idle if no event occurs. Each trigger type provides different data to the function, and the function's output depends on the trigger and its code. This event-driven model helps functions run only when needed.

Practice

(1/5)
1. Which Azure Function trigger type starts a function when a web request is received?
easy
A. Queue trigger
B. Timer trigger
C. HTTP trigger
D. Blob trigger

Solution

  1. Step 1: Understand trigger types

    HTTP triggers start functions when they receive web requests.
  2. Step 2: Match trigger to event

    Since the question asks about web requests, HTTP trigger is the correct match.
  3. Final Answer:

    HTTP trigger -> Option C
  4. Quick Check:

    Web request triggers = HTTP trigger [OK]
Hint: Web requests always use HTTP triggers [OK]
Common Mistakes:
  • Confusing Timer with HTTP
  • Thinking Blob triggers handle web requests
  • Mixing Queue triggers with HTTP
2. Which of the following is the correct way to define a Timer trigger in Azure Functions using function.json?
easy
A. {"bindings": [{"type": "timerTrigger", "direction": "in", "name": "myTimer", "schedule": "0 */5 * * * *"}]}
B. {"bindings": [{"type": "httpTrigger", "direction": "in", "name": "req"}]}
C. {"bindings": [{"type": "blobTrigger", "direction": "in", "name": "myBlob", "path": "samples-workitems/{name}"}]}
D. {"bindings": [{"type": "queueTrigger", "direction": "in", "name": "myQueueItem", "queueName": "myqueue-items"}]}

Solution

  1. Step 1: Identify Timer trigger syntax

    Timer triggers use type "timerTrigger" and include a "schedule" property.
  2. Step 2: Match JSON with Timer trigger

    {"bindings": [{"type": "timerTrigger", "direction": "in", "name": "myTimer", "schedule": "0 */5 * * * *"}]} has type "timerTrigger" and a cron schedule, matching Timer trigger format.
  3. Final Answer:

    Option A JSON with timerTrigger and schedule -> Option A
  4. Quick Check:

    Timer trigger needs "timerTrigger" type and schedule [OK]
Hint: Timer triggers always include a cron schedule in function.json [OK]
Common Mistakes:
  • Using httpTrigger type for Timer
  • Missing schedule property
  • Confusing Blob or Queue trigger syntax
3. Given this Azure Function code snippet using a Queue trigger:
public static void Run([QueueTrigger("myqueue-items")] string myQueueItem, ILogger log) {
    log.LogInformation($"Processed queue item: {myQueueItem}");
}

What will be logged when a message "Hello" is added to the queue?
medium
A. Processed queue item: Hello
B. Processed queue item: myqueue-items
C. Queue trigger error
D. No log output

Solution

  1. Step 1: Understand Queue trigger behavior

    The function runs when a message arrives in "myqueue-items" queue, passing the message content as myQueueItem.
  2. Step 2: Analyze log output

    The log prints "Processed queue item: " plus the message content, which is "Hello".
  3. Final Answer:

    Processed queue item: Hello -> Option A
  4. Quick Check:

    Queue message content logged = "Processed queue item: Hello" [OK]
Hint: Queue trigger passes message content as parameter [OK]
Common Mistakes:
  • Logging queue name instead of message
  • Expecting error without cause
  • Assuming no output from trigger
4. You wrote this Azure Function with a Blob trigger:
public static void Run([BlobTrigger("samples-workitems/{name}")] Stream myBlob, string name, ILogger log) {
    log.LogInformation($"Blob name: {name}, Size: {myBlob.Length} bytes");
}

But the function never runs when you upload blobs. What is the most likely cause?
medium
A. Blob triggers require HTTP requests to start
B. The Blob trigger path is incorrect or container name is wrong
C. The function is missing a Timer trigger
D. The function must use Queue trigger instead

Solution

  1. Step 1: Check Blob trigger path

    The Blob trigger listens to a specific container path; if the container name or path is wrong, it won't trigger.
  2. Step 2: Eliminate other causes

    Timer triggers or HTTP requests are unrelated; Blob triggers respond to storage changes only.
  3. Final Answer:

    The Blob trigger path is incorrect or container name is wrong -> Option B
  4. Quick Check:

    Blob trigger needs correct container path to run [OK]
Hint: Blob trigger must match exact container path [OK]
Common Mistakes:
  • Expecting Timer or HTTP triggers to start Blob
  • Wrong container or path in BlobTrigger attribute
  • Confusing Blob and Queue triggers
5. You want to run an Azure Function every day at 3 AM and also process any new files uploaded to a Blob container immediately. Which trigger types should you combine in your solution?
hard
A. HTTP trigger for schedule and Queue trigger for file uploads
B. Blob trigger for schedule and HTTP trigger for file uploads
C. Queue trigger for schedule and Timer trigger for file uploads
D. Timer trigger for schedule and Blob trigger for file uploads

Solution

  1. Step 1: Identify trigger for scheduled runs

    Timer triggers run functions on schedules like daily at 3 AM.
  2. Step 2: Identify trigger for file uploads

    Blob triggers respond immediately to new files uploaded to Blob storage.
  3. Step 3: Combine triggers correctly

    Use Timer trigger for scheduled runs and Blob trigger for file events.
  4. Final Answer:

    Timer trigger for schedule and Blob trigger for file uploads -> Option D
  5. Quick Check:

    Schedule = Timer, File upload = Blob trigger [OK]
Hint: Schedule needs Timer; file events need Blob trigger [OK]
Common Mistakes:
  • Using HTTP trigger for schedule
  • Mixing Queue with schedule incorrectly
  • Confusing Blob and HTTP triggers