0

I want to pass the filename of blob to the httptrigger, through get request as below.

http://localhost:7071/api/CSVDataMigrationHttpTrigger/testdata.csv

Code for the azure function

public static async Task<HttpResponseMessage> Run(
        [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "CSVDataMigrationHttpTrigger/{name}")]
        HttpRequest req, string name,
        [Blob("csvdata-upload/{name}", FileAccess.Read, Connection = "AzureWebJobsStorage")]
        Stream inputBlob, ILogger log)
    {}

inputBlob parameter is not resolved and it returns null.

But if i give filename as "testData.csv" as below in the Blob parameter, then inputBlob get resolved properly.

  public static async Task<HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "CSVDataMigrationHttpTrigger/{name}")]
            HttpRequest req, string name,
            [Blob("csvdata-upload/testData.csv", FileAccess.Read, Connection = "AzureWebJobsStorage")]
            Stream inputBlob, ILogger log){}
8
  • I tried with the same code, I can able to get the value of name as test.csv. Did you try with the latest SDK? Commented Oct 10, 2018 at 15:35
  • I can get the value too, the inputBlob is null Commented Oct 10, 2018 at 16:03
  • 1
    Make sure the inputblob is already available in the blob container. I tried the same and I can get the stream in the inputblob . Please make sure you uploaded the test.csv inyour blob container. The Stream inputblob will be null only if you not have the corresponding blob in that container Commented Oct 10, 2018 at 16:14
  • It is there, that is why second code works Commented Oct 10, 2018 at 16:30
  • 1
    Do you have any update on this? Did you check the spelling ? Commented Oct 12, 2018 at 10:25

2 Answers 2

1

I found out finally, the filename was case sensitive, when passed to blob. Hope it helps anyone who has the same issue.

Sign up to request clarification or add additional context in comments.

Comments

1

Check whether your blob is actually uploaded in the Storage Container. The stream will be null only if the blob is Not Exist/Unable to find in the container

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.