A function does nothing on its own. A trigger starts it: a time of day, a request, a message, a new file, an event. Every function has exactly one. Bindings additionally connect it with data: an input binding reads before the call, an output binding writes after it. In module 3.5 you built the import of the tenders as a worker in Container Apps that reads a queue. In this lesson the Kladde builds the same import as Functions: a timer that starts at night, and a function that processes every message, both with managed identity, both so that a duplicate message does nothing twice.

New in this lesson:

Package Version what for
Microsoft.Azure.Functions.Worker.Extensions.Timer 4.3.1 the timer trigger
Microsoft.Azure.Functions.Worker.Extensions.ServiceBus 5.24.0 trigger and output for Service Bus
Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs 6.8.2 trigger and bindings for Blob Storage (in outline)
Microsoft.Azure.Functions.Worker.Extensions.EventGrid 3.6.0 the Event Grid trigger (in outline)

The Kladde's triggers

Trigger Attribute when it fires what it needs
Timer [TimerTrigger("0 30 3 * * *")] on a schedule the host's storage, which holds a lock so that only one instance runs
HTTP [HttpTrigger(...)] on a request nothing more; in Azure a function key, except with Anonymous
Service Bus [ServiceBusTrigger("notices", Connection = "...")] per message of a queue or a subscription a connection and the role for receiving
Blob [BlobTrigger("raw-data/{name}", Source = BlobTriggerSource.EventGrid)] on a new or changed file in Flex Consumption, an event subscription from Event Grid
Event Grid [EventGridTrigger] on an event from Event Grid (module 3.5) an event subscription with the function as its target

Three things about the triggers:

  • The timer's schedule is an NCRONTAB expression with six fields, the first being the seconds: 0 30 3 * * * means every day at 03:30:00. The time is UTC. TimerInfo.IsPastDue tells you whether a run comes late, for example after a restart.
  • The blob trigger comes in two kinds. The older one polls the container regularly and is slow with many files. The newer one gets the changes as events from Event Grid (Source = BlobTriggerSource.EventGrid), and only this one exists in Flex Consumption.
  • An HTTP trigger is meant for calls that answer quickly. For long work it only starts it and returns 202 (lesson 3.9.1); lesson 3.13.3 shows Durable Functions for that.