Azure Blob storage bindings for Azure Functions overview
Azure Functions integrates with Azure Storage via triggers and bindings. Integrating with Blob storage allows you to build functions that react to changes in blob data as well as read and write values.
Action | Type |
---|---|
Run a function as blob storage data changes | Trigger |
Read blob storage data in a function | Input binding |
Allow a function to write blob storage data | Output binding |
Install extension
The extension NuGet package you install depends on the C# mode you're using in your function app:
Functions execute in the same process as the Functions host. To learn more, see Develop C# class library functions using Azure Functions.
The functionality of the extension varies depending on the extension version:
This version introduces the ability to connect using an identity instead of a secret. For a tutorial on configuring your function apps with managed identities, see the creating a function app with identity-based connections tutorial.
This version allows you to bind to types from Azure.Storage.Blobs. Learn more about how these new types are different from WindowsAzure.Storage
and Microsoft.Azure.Storage
and how to migrate to them from the Azure.Storage.Blobs Migration Guide.
This extension is available by installing the Microsoft.Azure.WebJobs.Extensions.Storage.Blobs NuGet package, version 5.x.
Using the .NET CLI:
dotnet add package Microsoft.Azure.WebJobs.Extensions.Storage.Blobs --version 5.0.0
Note
Azure Blobs, Azure Queues, and Azure Tables now use separate extensions and are referenced individually. For example, to use the triggers and bindings for all three services in your .NET in-process app, you should add the following packages to your project:
- Microsoft.Azure.WebJobs.Extensions.Storage.Blobs
- Microsoft.Azure.WebJobs.Extensions.Storage.Queues
- Microsoft.Azure.WebJobs.Extensions.Tables
Previously, the extensions shipped together as Microsoft.Azure.WebJobs.Extensions.Storage, version 4.x. This same package also has a 5.x version, which references the split packages for blobs and queues only. When upgrading your package references from older versions, you may therefore need to additionally reference the new Microsoft.Azure.WebJobs.Extensions.Tables NuGet package. Also, when referencing these newer split packages, make sure you are not referencing an older version of the combined storage package, as this will result in conflicts from two definitions of the same bindings.
Install bundle
The Blob storage binding is part of an extension bundle, which is specified in your host.json project file. You may need to modify this bundle to change the version of the binding, or if bundles aren't already installed. To learn more, see extension bundle.
This version introduces the ability to connect using an identity instead of a secret. For a tutorial on configuring your function apps with managed identities, see the creating a function app with identity-based connections tutorial.
You can add this version of the extension from the extension bundle v3 by adding or replacing the following code in your host.json
file:
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.3.0, 4.0.0)"
}
}
To learn more, see Update your extensions.
Binding types
The binding types supported for .NET depend on both the extension version and C# execution mode, which can be one of the following:
An in-process class library is a compiled C# function runs in the same process as the Functions runtime.
Choose a version to see binding type details for the mode and version.
The Azure Blobs extension supports parameter types according to the table below.
Binding | Parameter types |
---|---|
Blob trigger | StreamTextReader string byte[] BlobClient1 BlockBlobClient1 PageBlobClient1 AppendBlobClient1 BlobBaseClient1 |
Blob input | StreamTextReader string byte[] BlobClient1 BlockBlobClient1 PageBlobClient1 AppendBlobClient1 BlobBaseClient1 IEnumerable<T> 2 |
Blob output | StreamTextWriter string byte[] |
1 The client types require the Access
property of the attribute to be set to FileAccess.ReadWrite
.
2 IEnumerable<T>
provides an enumeration of blobs in the container. Here, T
can be any of the other supported types.
For examples using these types, see the GitHub repository for the extension. Learn more about these new types are different and how to migrate to them from the Azure.Storage.Blobs Migration Guide.
host.json settings
This section describes the function app configuration settings available for functions that use this binding. These settings only apply when using extension version 5.0.0 and higher. The example host.json file below contains only the version 2.x+ settings for this binding. For more information about function app configuration settings in versions 2.x and later versions, see host.json reference for Azure Functions.
Note
This section doesn't apply to extension versions before 5.0.0. For those earlier versions, there aren't any function app-wide configuration settings for blobs.
{
"version": "2.0",
"extensions": {
"blobs": {
"maxDegreeOfParallelism": 4
}
}
}
Property | Default | Description |
---|---|---|
maxDegreeOfParallelism | 8 * (the number of available cores) | The integer number of concurrent invocations allowed for each blob-triggered function. The minimum allowed value is 1. |
Next steps
Feedback
Submit and view feedback for