Tutorial by Examples

The Azure Webjobs SDK is a framework distributed as a Nuget package aimed at helping you define Functions that are run by Triggers and use Bindings to other Azure services (like Azure Storage and Service Bus) in a declarative fashion. The SDK uses a JobHost to coordinate your coded Functions. In a ...
A simple example defining a Function that gets triggered by a Queue message: public static void StringMessage([QueueTrigger("my_queue")] string plainText) { //... } It also supports POCO serialization: public static void POCOMessage([QueueTrigger("my_queue")] MyPO...
A simple example of a Function that gets triggered when a Azure Storage Blob is modified: public static async Task BlobTrigger( [BlobTrigger("my_container/{name}.{ext}")] Stream input, string name, string ext) { //Blob with name {name} and extension {ext} using (StreamRead...
The SDK supports time triggered based on CRON expressions with 6 fields ({second} {minute} {hour} {day} {month} {day of the week}). It requires an extra setting on the JobHostConfiguration: config.UseTimers(); Your time triggered functions respond to this syntax: // Runs once every 5 minutes p...
Error handling is extremely important, we can define functions to be triggered when an execution error happens in one of your triggered functions: //Fires when 10 errors occur in the last 30 minutes (sliding) public static void ErrorMonitor([ErrorTrigger("0:30:00", 10)] TraceFilter filte...
Azure Webjobs run on an Azure App Service. If we scale our App Service horizontally (add new instances), each instance will have its own JobHost. Note that this only applies to WebJobs running in Continuous mode. On-demand and scheduled WebJobs are not affected by horizontal scaling, they always ru...
The WebJobs Dashboard shows logs in two places: the page for the WebJob, and the page for a particular WebJob invocation. Output from Console methods that you call in a function or in the Main() method appears in the Dashboard page for the WebJob, not in the page for a particular method invocation....
The following example shows how to set up Dependency Injection using Ninject as an IoC container. First add a CustomModule class to your WebJob project, and add any dependency bindings there. public class CustomModule : NinjectModule { public override void Load() { Bind<IMyI...

Page 1 of 1