Cannot use CloudBlockBlob as input parameter for an azure blob trigger using .Net 6 (C#)

Fabian Trottmann 66 Reputation points
2022-02-23T18:55:15.013+00:00

I'm trying to get a CloudBlockBlob instead of a Stream, whenever a new blob is stored on an azure blob storage. The reason I want to have a CloudBlockBlob is that I can call DeleteIfExisits, and remove the blob after processing.

The following signature does not work:
BlobTriggerAdvanced([BlobTrigger(@"mycontainer/{name}")] CloudBlockBlob blob)

This works:
BlobTriggerAdvanced([BlobTrigger(@"mycontainer/{name}")] Stream blob)

I get the following error with the CloudBlockBlob option:
Microsoft.Azure.WebJobs.Host: Error indexing method 'Test'. Microsoft.Azure.WebJobs.Host: Can't bind BlobTrigger to type 'Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob'

Has it something to do with the missing InOut parameter? Where can I apply that param?

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Anonymous
    2022-02-25T19:19:59.363+00:00

    anonymous user

    I understand you are using CloudBlockBlob in your Azure function but encountering an error. Please note that Microsoft.WindowsAzure.Storage is deprecated and we recommend using the latest which is Azure.Storage.Blobs.

    Please see this previous thread were user was facing the same error. It was related to referencing the incorrect packages.

    Hope this helps. Let us know if you are still having issues and we can investigate further.


    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

  2. Fabian Trottmann 66 Reputation points
    2022-02-28T13:03:24.64+00:00

    Yes I'm aware of this, Azure.Storage.Blobs v12.10 is used: ![178487-packages.png][1] Furthermore, I'm usiong .Net 6.0 and .Net.Sdk.Functions 4.0.1. Still get this error: he 'CloudBlockTrigger' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'CloudBlockTrigger'. Microsoft.Azure.WebJobs.Host: Can't bind BlobTrigger to type 'Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob'. This is my code: ![178506-function-trigger.png][2] [1]: /api/attachments/178487-packages.png?platform=QnA [2]: /api/attachments/178506-function-trigger.png?platform=QnA


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.