liveBook · Manning

Output binding

As explained in Microsoft Azure in Action

An output binding is an Azure Functions binding that sends function-produced data to an external resource.

An output binding lets an Azure Function send produced data to an external resource. In a practical image-processing flow, the function writes a resized image to Blob Storage without handling storage access directly. section 8.2.2

A typical output-binding workflow:

  • Declare a Blob output binding alongside the HTTP trigger. section 8.2.2
  • Receive the destination as a writable stream, resize the image, and save it to the stream. section 8.2.2
  • Test locally with images in an Azurite Blob container before deploying from VS Code. section 8.2.2
[FunctionName("ProcessNFT")]
public static void Run(
    [HttpTrigger(AuthorizationLevel.Anonymous, 
"get", "post", Route = "nft/{nftid}")] HttpRequest req,    #1
    [Blob("originalnfts/{nftid}", FileAccess.Read)] 
Stream nftImage,    #2
    [Blob("copynfts/{nftid}", FileAccess.Write)] 
Stream nftSmall)    #3
{
    IImageFormat format;

    using (Image<Rgba32> input = 
Image.Load<Rgba32>(nftImage, out format))    #4
    {
        input.Mutate(x => x.Resize(320, 200));    #5
        input.Save(nftSmall, format);    #6
    }
}

The annotated function shows the output binding writing the resized image to copynfts/{nftid}. section 8.2.2

How Microsoft Azure in Action covers it

How deep it goes
Descends to decorator configuration, stream-based processing, package setup, emulator use, and local execution.
Examples
Uses ProcessNFT to read originalnfts/{nftid}, resize an image, and write copynfts/{nftid}.
What it assumes
Teaches binding placement and local setup within a C# Azure Function project using VS Code.
What you can do after
Apply it via Azure Functions by configuring a writable Blob stream and saving resized images locally.
How it connects
Links output binding with HTTP triggers, input bindings, Blob Storage, Azurite, and image resizing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microsoft Azure in Action. The section links point to the parts of the book it draws on.