anonymous
anonymous

Reputation: 1

azure function - Blob input binding

Iam new to azure, any help is appreciated

In azure function we can give an input binding as below.

[QueueTrigger("myqueue-items")] string myQueueItem,
    [Blob("samples-workitems/{queueTrigger}", FileAccess.Read)] Stream myBlob,
    ILogger log)

Also, I see few codes where we use the below and they dont add the above lines. Can anyone explain the usage of these both.

BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(ContainerName);
BlobClient blobClient = containerClient.GetBlobClient(fileName);

I have tried both the procedures and both of them works fine. I wanted to understand the significance of the usage

Upvotes: 0

Views: 443

Answers (1)

silent
silent

Reputation: 16108

The first example is using input bindings for Functions. You can think of them like "managed connections". You dont need to worry about how the Blob in that case is being fetched from the storage account. It is abstracted away from you.

However, if you need more control over that, the second one comes into play. You are creating your own BlobClient etc with all the options available. This you could use anywhere, not just with Azure Functions.

Upvotes: 1

Related Questions