Azure Functions Bindings

API Reference and Documentation

API Reference for Azure Functions Bindings

This document provides a detailed reference for the various bindings available in Azure Functions. Bindings simplify your code by allowing you to connect to other Azure services and external data sources without complex integration code.

Input Bindings

Input bindings allow you to read data from a service or storage into your function.

Blob Storage Input

Reads a blob from Azure Blob Storage.

{name} : blob : path

Example: myBlob : blob : container/{name}.txt

Cosmos DB Input

Reads a document from Azure Cosmos DB.

{name} : cosmosDB : databaseName : collectionName : id

Example: myDocument : cosmosDB : MyDb : Items : {id}

Event Hubs Input

Reads a single event from an Azure Event Hub.

{name} : eventHub : path

Example: myEvent : eventHub : myEventHub

Queue Storage Input

Reads a message from an Azure Queue Storage queue.

{name} : queue : queueName

Example: myQueueItem : queue : myQueue

Table Storage Input

Reads an entity from Azure Table Storage.

{name} : table : tableName : PartitionKey : RowKey

Example: myTableEntity : table : MyTable : Partition1 : Row1

Service Bus Queue Input

Reads a single message from a Service Bus queue.

{name} : serviceBusQueue : queueName

Example: myServiceBusMessage : serviceBusQueue : myQueue

Service Bus Topic Input

Reads a single message from a Service Bus topic subscription.

{name} : serviceBusTopic : topicName : subscriptionName

Example: myServiceBusTopicMessage : serviceBusTopic : myTopic : mySubscription

Output Bindings

Output bindings allow you to write data to a service or storage from your function.

Blob Storage Output

Writes data to a blob in Azure Blob Storage.

{name} : blob : path

Example: outputBlob : blob : container/{name}.txt

Cosmos DB Output

Writes a document to Azure Cosmos DB.

{name} : cosmosDB : databaseName : collectionName

Example: outputDocument : cosmosDB : MyDb : Items

Queue Storage Output

Writes a message to an Azure Queue Storage queue.

{name} : queue : queueName

Example: outputQueueMessage : queue : myQueue

Table Storage Output

Writes or updates an entity in Azure Table Storage.

{name} : table : tableName

Example: outputTableEntity : table : MyTable

Service Bus Queue Output

Sends a message to a Service Bus queue.

{name} : serviceBusQueue : queueName

Example: outputServiceBusMessage : serviceBusQueue : myQueue

Service Bus Topic Output

Sends a message to a Service Bus topic.

{name} : serviceBusTopic : topicName

Example: outputServiceBusTopicMessage : serviceBusTopic : myTopic

Trigger Bindings

Trigger bindings start your function execution in response to an event.

Blob Trigger

Triggered when a blob is created or updated.

{name} : blobTrigger : path

Example: myBlobTrigger : blobTrigger : container/{name}.txt

Cosmos DB Trigger

Triggered when documents are created or updated in a Cosmos DB collection.

{name} : cosmosDBTrigger : databaseName : collectionName

Example: myCosmosDbTrigger : cosmosDBTrigger : MyDb : Items

Event Grid Trigger

Triggered by events published to Azure Event Grid.

{name} : eventGridTrigger

Example: myEventGridTrigger : eventGridTrigger

Event Hubs Trigger

Triggered by events sent to an Azure Event Hub.

{name} : eventHubTrigger : path

Example: myEventHubTrigger : eventHubTrigger : myEventHub

HTTP Trigger

Triggered by an HTTP request.

{name} : httpTrigger : methods : authLevel

Example: myHttpTrigger : httpTrigger : POST,GET : function

Queue Trigger

Triggered when a new message is available in an Azure Queue Storage queue.

{name} : queueTrigger : queueName

Example: myQueueTrigger : queueTrigger : myQueue

Service Bus Queue Trigger

Triggered by messages arriving in a Service Bus queue.

{name} : serviceBusTrigger : queueName

Example: myServiceBusQueueTrigger : serviceBusTrigger : myQueue

Service Bus Topic Trigger

Triggered by messages arriving on a Service Bus topic subscription.

{name} : serviceBusTrigger : topicName : subscriptionName

Example: myServiceBusTopicTrigger : serviceBusTrigger : myTopic : mySubscription

Timer Trigger

Triggered on a schedule defined by a CRON expression.

{name} : timerTrigger : schedule

Example: myTimerTrigger : timerTrigger : '0 */5 * * * *'

Binding Configuration

Bindings are configured in the function.json file for each function. The configuration specifies the binding type, direction (in, out, or trigger), name, and service-specific properties.

Here's a simplified example of a function.json for a function that reads from a blob and writes to a queue:


{
  "scriptFile": "run.py",
  "bindings": [
    {
      "name": "myBlob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "input-container/{name}.txt",
      "connection": "AzureWebJobsStorage"
    },
    {
      "name": "outputQueueItem",
      "type": "queue",
      "direction": "out",
      "queueName": "output-queue",
      "connection": "AzureWebJobsStorage"
    }
  ]
}
            

Common Binding Properties

For detailed configuration options for each binding type, please refer to the specific service documentation.