Azure / Azure/azure-functions-core-tools

Identity Based Blob triggers fail locally

Open
#3,443 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

Context

A blob triggered function written in Java:

```
@FunctionName("blob")
public String execute(
@BlobTrigger(name = "test", path = "testcontainer/{name}", connection = "BlobTriggerConnection")
String content, ExecutionContext context) {
// function's code
}
```

Based on the [documentation](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-trigger?tabs=python-v2%2Cin-process&pivots=programming-language-csharp#identity-based-connections), to use identity based triggers, following App Settings entries must be created:

- `BlobTriggerConnection__blobServiceUri`
- `BlobTriggerConnection__queueServiceUri`
- `BlobTriggerConnection__credential`

Moreover, function's identity must have correct permissions on the blob storage.

I've done that in Azure and it works well.

Problem

However, running the function locally along with `Azurite` fails with the following error:

```
Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.blob'. Microsoft.Extensions.Azure: Unable to find matching constructor while trying to create an instance of BlobServiceClient.
Expected one of the follow sets of configuration parameters:
1. connectionString
2. serviceUri
3. serviceUri, credential:accountName, credential:accountKey
4. serviceUri, credential:signature
5. serviceUri

Found the following configuration keys: queueServiceUri, credential, blobServiceUri.
```

**It is as if identity based triggers aren't supported.**

`local.settings.json` file's content:

```
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "java",
"BlobTriggerConnection__blobServiceUri": "UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1:10000",
"BlobTriggerConnection__credential": "managedidentity",
"BlobTriggerConnection__queueServiceUri": "UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1:10001"
}
}
```

I'm using the latest version of tools locally:

```
> brew search azure-functions-core-tools

azure/functions/azure-functions-core-tools@4
```

I should point out that this is a MacBook with intel's chipset.

Contributor guide

Open the contributing guide

Research direction

Reproduce the Java blob-trigger function with Azurite using the shown local.settings.json values and the BlobTriggerConnection settings. Start by tracing how local identity-based connection parameters are handled, then verify that the trigger indexes and runs locally without the BlobServiceClient constructor error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, java
Domain
cloud, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.