Skip to content

function.json

Mathew Charles edited this page Feb 11, 2016 · 29 revisions

In a script function directory, there should be a companion function.json file that contains the configuration metadata for the function. Below are examples for each of the trigger types.

HttpTrigger Example:

{
  "bindings": {
    "input": [
      {
        "type": "httpTrigger",
        "route" "orders",
        "authLevel" "anonymous"
      }
    ]
  }
}

WebHook Example:

{
  "bindings": {
    "input": [
      {
        "type": "httpTrigger",
        "webHookType": "github"
      }
    ]
  }
}

QueueTrigger Example:

{
  "bindings": {
    "input": [
      {
        "type": "queueTrigger",
        "name": "workItem",
        "queueName": "samples-workitems"
      }
    ]
  }
}

BlobTrigger Example:

{
  "bindings": {
    "input": [
      {
        "type": "blobTrigger",
        "path": "samples-workitems"
      }
    ]
  }
}

TimerTrigger Example:

{
  "bindings": {
    "input": [
      {
        "type": "timerTrigger",
        "schedule": "*/15 * * * * *",
        "runOnStartup": true
      }
    ]
  }
}

ServiceBusTrigger Example (Queue):

{
  "bindings": {
    "input": [
      {
        "type": "serviceBusTrigger",
        "queueName": "testqueue"
      }
    ]
  }
}

ServiceBusTrigger Example (Topic):

{
  "bindings": {
    "input": [
      {
        "type": "serviceBusTrigger",
        "topicName": "testtopic",
        "subscriptionName": "testsubscription"
      }
    ]
  }
}

ManualTrigger Example (Can only be run by invoking via WebHost admin API):

{
  "bindings": {
    "input": [
      {
        "type": "manualTrigger"
      }
    ]
  }
}

Function bindings can get pretty sophisticated. In addition to trigger input bindings, they can also declare non-trigger input bindings which can be used to read objects from storage and make them available to script. They can also declare output bindings that can write result objects to storage.

Here's a canonical example for a function that receives a queue message, reads an input blob, processes that blob and writes the result to another blob:

{
  "bindings": {
    "input": [
      {
        "type": "queueTrigger",
        "queueName": "image-resize"
      },
      {
        "type": "blob",
        "name": "original",
        "path": "images-input/{name}"
      }
    ],
    "output": [
      {
        "type": "blob",
        "name": "resized",
        "path": "images-output/{name}"
      }
    ]
  }
}

For all bindings, the type value must be one of the supported binding types (e.g. "queue", "queueTrigger", "blob", "blobTrigger", "table", etc.). The name value defines the identifier that the script will use to write to the binding. The remaining properties are binding type specific. For a blob binding there is a path property, for a queue binding a queueName property, etc.

Learn

Azure Functions Basics

Advanced Concepts

Dotnet Functions

Java Functions

Node.js Functions

Python Functions

Host API's

Bindings

V2 Runtime

Contribute

Functions host

Language workers

Get Help

Other

Clone this wiki locally