0

I am trying to implement ADLS2 blob trigger function using Azure managed identity instead of using connection string

So here is my function

public class BlobTrigger
{
    [FunctionName("BlobTrigger")]
    public void Run([BlobTrigger("sample/my-directory/{name}", Connection = "MyConnection")]Stream myBlob, string name, ILogger log)
    {
        log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
    }
}

and here is the local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    //Blob trigger
    "MyConnection__blobServiceUri": "https://mystorageaccount.blob.core.windows.net",
    "MyConnection__queueServiceUri": "https://mystorageaccount.queue.core.windows.net"
  }
}

Here are the docs I was following

But when executing, I am getting below error

[2022-07-14T08:12:12.343Z] An unhandled exception has occurred. Host is shutting down.
[2022-07-14T08:12:12.346Z] Azure.Storage.Blobs: Service request failed.
[2022-07-14T08:12:12.348Z] Status: 400 (The value for one of the HTTP headers is not in the correct format.)
[2022-07-14T08:12:12.351Z] ErrorCode: InvalidHeaderValue
[2022-07-14T08:12:12.353Z]
[2022-07-14T08:12:12.355Z] Headers:
[2022-07-14T08:12:12.357Z] Server: Azurite-Blob/3.16.0
[2022-07-14T08:12:12.359Z] x-ms-error-code: InvalidHeaderValue
[2022-07-14T08:12:12.362Z] x-ms-request-id: 7b6aa13d-3373-405d-b11d-3a658f85a019
[2022-07-14T08:12:12.364Z] Date: Thu, 14 Jul 2022 08:12:12 GMT
[2022-07-14T08:12:12.366Z] Connection: keep-alive
[2022-07-14T08:12:12.371Z] Keep-Alive: REDACTED

Sorry I didnt understand what did I missed or what i did wrong.

I am having access to the storage and using the same account visual studio as well authenticated into Azure. I can see the same blob trigger connected in service dependencies.

enter image description here

Sandeep Thomas
  • 4,303
  • 14
  • 61
  • 132

1 Answers1

0
  • If you are using azurite (Storage emulator) while executing the function locally then this is a known issue.

  • This happens because the azurite will send the invalid header error when the incoming api request is of higher version than azurite.

  • The solution is simple just update the azurite and use the latest version of blob storage sdk too.

Refer the following thread.

Refer this doc.

Mohit Ganorkar
  • 1,917
  • 2
  • 6
  • 11