Azure功能Blob跨资源组触发

时间:2020-09-17 08:17:36

标签: azure-functions

我正在在ResourceGroup1上使用基于Python的Azure函数。我希望在ResourceGroup2的StorageAccount的容器内创建新的Blob后立即触发该函数。我不确定如何设置连接字符串或路径。现在我正在尝试:

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "myblob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "container_name/test.txt",
      "connection": "ResourceGroup2/StorageAccount_name"
    }
  ]
}

但是,这不起作用...

1 个答案:

答案 0 :(得分:1)

您应该从此位置获取连接字符串:

enter image description here

如果您是在Azure上开发,则function.json应该像这样:

{
  "bindings": [
    {
      "name": "myBlob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "samples-workitems/{name}",
      "connection": "TheConnectionString"
    }
  ]
}

您应该在此处添加TheConnectionString:

enter image description here

如果您在本地开发,请在以下位置添加字符串:

local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "xxxxxx"
  }
}