A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/azure/azure-functions/scripts/../functions-bindings-storage-blob below:

Azure Blob storage trigger and bindings for Azure Functions

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:

The functionality of the extension varies depending on the extension version:

This section describes using a class library. For C# scripting, you would need to instead install the extension bundle, version 4.x.

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:

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.

This section describes using a class library. For C# scripting, you would need to instead install the extension bundle, version 2.x.

Working with the trigger and bindings requires that you reference the appropriate NuGet package. Install the Microsoft.Azure.WebJobs.Extensions.Storage NuGet package, version 4.x. The package is used for .NET class libraries while the extension bundle is used for all other application types.

Functions 1.x apps automatically have a reference the Microsoft.Azure.WebJobs NuGet package, version 2.x.

In Functions 1.x, the Storage triggers and bindings use version 7.2.1 of the Azure Storage SDK (WindowsAzure.Storage NuGet package). If you reference a different version of the Storage SDK, and you bind to a Storage SDK type in your function signature, the Functions runtime may report that it can't bind to that type. The solution is to make sure your project references WindowsAzure.Storage 7.2.1.

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 version supports configuration of triggers and bindings through .NET Aspire integration.

Add the extension to your project by installing the Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs NuGet package, version 5.x or later.

Using the .NET CLI:

dotnet add package Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs

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 isolated-process app, you should add the following packages to your project:

Previously, the extensions shipped together as Microsoft.Azure.Functions.Worker.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.Functions.Worker.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.

If you're writing your application using F#, you must also configure this extension as part of the app's startup configuration. In the call to ConfigureFunctionsWorkerDefaults() or ConfigureFunctionsWebApplication(), add a delegate that takes an IFunctionsWorkerApplication parameter. Then within the body of that delegate, call ConfigureBlobStorageExtension() on the object:

let hostBuilder = new HostBuilder()
hostBuilder.ConfigureFunctionsWorkerDefaults(fun (context: HostBuilderContext) (appBuilder: IFunctionsWorkerApplicationBuilder) ->
    appBuilder.ConfigureBlobStorageExtension() |> ignore
) |> ignore

Add the extension to your project by installing the Microsoft.Azure.Functions.Worker.Extensions.Storage NuGet package, version 4.x.

Functions version 1.x doesn't support isolated worker process.

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.

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 isolated worker process class library compiled C# function runs in a process isolated from the runtime.

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.

1 The client types require the Access property of the attribute to be set to FileAccess.ReadWrite.

For examples using these types, see the GitHub repository for the extension. Learn more about types from the Azure SDK, how they are different from earlier versions, and how to migrate to them from the Azure.Storage.Blobs Migration Guide.

Earlier versions of the extension exposed types from the now deprecated Microsoft.Azure.Storage.Blob namespace. Newer types from Azure.Storage.Blobs are exclusive to extension 5.x and higher.

This version of the Azure Blobs extension supports parameter types according to the table below.

1 These 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.

Functions 1.x exposed types from the deprecated Microsoft.WindowsAzure.Storage namespace. Newer types from Azure.Storage.Blobs are exclusive to Extension 5.x and higher. To use these, you will need to upgrade your application to Functions 4.x.

The isolated worker process supports parameter types according to the tables below.

Blob trigger

The blob trigger can bind to the following types:

Type Description string The blob content as a string. Use when the blob content is simple text. byte[] The bytes of the blob content. JSON serializable types When a blob contains JSON data, Functions tries to deserialize the JSON data into a plain-old CLR object (POCO) type. Stream1 An input stream of the blob content. BlobClient1,
BlockBlobClient1,
PageBlobClient1,
AppendBlobClient1,
BlobBaseClient1 A client connected to the blob. This set of types offers the most control for processing the blob and can be used to write back to the blob if the connection has sufficient permission.

1 To use these types, you need to reference Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs 6.0.0 or later and the common dependencies for SDK type bindings.

Blob input binding

When you want the function to process a single blob, the blob input binding can bind to the following types:

Type Description string The blob content as a string. Use when the blob content is simple text. byte[] The bytes of the blob content. JSON serializable types When a blob contains JSON data, Functions tries to deserialize the JSON data into a plain-old CLR object (POCO) type. Stream1 An input stream of the blob content. BlobClient1,
BlockBlobClient1,
PageBlobClient1,
AppendBlobClient1,
BlobBaseClient1 A client connected to the blob. This set of types offers the most control for processing the blob and can be used to write back to it if the connection has sufficient permission.

When you want the function to process multiple blobs from a container, the blob input binding can bind to the following types:

Type Description T[] or List<T> where T is one of the single blob input binding types An array or list of multiple blobs. Each entry represents one blob from the container. You can also bind to any interfaces implemented by these types, such as IEnumerable<T>. BlobContainerClient1 A client connected to the container. This type offers the most control for processing the container and can be used to write to it if the connection has sufficient permission.

1 To use these types, you need to reference Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs 6.0.0 or later and the common dependencies for SDK type bindings.

Blob output binding

When you want the function to write to a single blob, the blob output binding can bind to the following types:

Type Description string The blob content as a string. Use when the blob content is simple text. byte[] The bytes of the blob content. JSON serializable types An object representing the content of a JSON blob. Functions attempts to serialize a plain-old CLR object (POCO) type into JSON data.

When you want the function to write to multiple blobs, the blob output binding can bind to the following types:

Type Description T[] where T is one of the single blob output binding types An array containing content for multiple blobs. Each entry represents the content of one blob.

For other output scenarios, create and use a BlobClient or BlobContainerClient with other types from Azure.Storage.Blobs directly. See Register Azure clients for an example of using dependency injection to create a client type from the Azure SDK.

Earlier versions of extensions in the isolated worker process only support binding to string parameters. Additional options are available to extension 5.x and higher.

Functions version 1.x doesn't support isolated worker process. To use the isolated worker model, upgrade your application to Functions 4.x.

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,
            "poisonBlobThreshold": 1
        }
    }
}
Property Default Description maxDegreeOfParallelism 8 * (the number of available cores) The integer number of concurrent invocations allowed for all blob-triggered functions in a given function app. The minimum allowed value is 1. poisonBlobThreshold 5 The integer number of times to try processing a message before moving it to the poison queue. The minimum allowed value is 1. Next steps

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4