You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Functions基于身份的Blob触发器本地运行失败

背景信息

使用Java编写的Blob触发函数:

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

根据官方文档,要使用基于身份的触发器,必须创建以下应用设置项:

  • BlobTriggerConnection__blobServiceUri
  • BlobTriggerConnection__queueServiceUri
  • BlobTriggerConnection__credential

此外,函数的身份必须在Blob存储上拥有正确的权限。我在Azure环境中完成了上述配置,运行正常。

问题描述

但在本地结合Azurite运行该函数时失败,报错如下:

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.

看起来本地似乎不支持基于身份的触发器。

local.settings.json文件内容:

{
  "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"
  }
}

我本地使用的是最新版本的工具:

> brew search azure-functions-core-tools

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

补充说明:我使用的是搭载Intel芯片的MacBook。

内容的提问来源于stack exchange,提问作者Amir Keibi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 11:37:28