azure-managed-identityazure-durable-functions

Azure Durable Functions Identity-based queueTrigger binding '__queueServiceUri' does not exist


I've gone through the whole process of setting up an identity-based connection for my Python orchestrator activity.

However, for some reason, the env variable __queueServiceUri is not being recognized by the function app.

I have one default storage account that the app uses for its own management i.e. AzureWebJobs, and a second that I use for data processing. The issue is with the second one.

Below, are the function.json, function-relevant configs, and error message.

function.json
{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "msg",
      "type": "queueTrigger",
      "direction": "in",
      "queueName": "poison-handler",
      "connection": "PythonFasStorageAccount__queueServiceUri"
    }
  ]
}
function config
{
    "name": "PythonFasStorageAccount__credential",
    "value": "managedidentity",
    "slotSetting": false
  },
  {
    "name": "PythonFasStorageAccount__queueServiceUri",
    "value": "https://mystorage.queue.core.windows.net/",
    "slotSetting": false
  }
Error message
The 'QueueTrigger' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.QueueTrigger'. Microsoft.Azure.WebJobs.Extensions.Storage.Queues: Storage account connection string 'AzureWebJobs[CUSTOM-PREFIX]__queueServiceUri' does not exist. Make sure that it is a defined App Setting.

I noticed it prepended "AzureWebJobs" in the queue Uri variable: AzureWebJobs[CUSTOM-PREFIX]__queueServiceUri. Is that expected?

Also, why is it expecting to find a connection string?


Solution

  • The error was in my misunderstanding of the <CONNECTION_NAME_PREFIX>.

    On the function.json I've replaced the:

    "connection": "PythonFasStorageAccount__queueServiceUri"

    for

    "connection": "PythonFasStorageAccount"

    In the function configuration settings, the actual variable name should be <CONNECTION_NAME_PREFIX>__queueServiceUri.


    Also, make sure extensionBundle version supports identity-based trigger bindings.

    As of now, you can use:

      // host.json
    
      "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[4.0.0, 5.0.0)"
      },