Skip to content

07 - Extending with Triggers (Consumption)

Add Timer, Queue, and Blob triggers to your Consumption (Y1) PowerShell app. PowerShell uses the classic function.json binding model.

Timer Trigger

TimerExample/function.json:

{
  "bindings": [
    {
      "name": "Timer",
      "type": "timerTrigger",
      "direction": "in",
      "schedule": "0 */5 * * * *"
    }
  ]
}

TimerExample/run.ps1:

param($Timer)
Write-Information "Timer fired at $(Get-Date -Format o)"

Queue Trigger

QueueExample/function.json:

{
  "bindings": [
    {
      "name": "QueueItem",
      "type": "queueTrigger",
      "direction": "in",
      "queueName": "work-items",
      "connection": "AzureWebJobsStorage"
    }
  ]
}
param($QueueItem, $TriggerMetadata)
Write-Information "Dequeued: $QueueItem"

Blob Trigger

BlobExample/function.json:

{
  "bindings": [
    {
      "name": "InputBlob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "uploads/{name}",
      "connection": "AzureWebJobsStorage"
    }
  ]
}
param($InputBlob, $TriggerMetadata)
Write-Information "Blob $($TriggerMetadata.name) is $($InputBlob.Length) bytes"

Verification

Deploy, then drop a message on the work-items queue or upload a blob to uploads/. Confirm the invocation appears in az functionapp log tail.

Next Steps

Explore the Recipes Index for reusable binding patterns.

Next: Recipes Index — reusable PowerShell trigger and binding patterns.

See Also

Sources

Legacy hosting path

Consumption plan (Y1) content is provided for existing workloads. For most new serverless applications, prefer Flex Consumption.