Search code examples
azureazure-functionsazure-storage-queuesqueuetrigger

Storage account connection string does not exist - deploying Queue storage trigger for Azure Functions


I want to create an azure storage queue triggered azure function. I went through the following tutorial https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-trigger

I basically want to trigger the function whenever a message is pushed into the queue and push the result back to another queue once a function is finished.

function.json

{
  "bindings": [
    {
      "name": "input",
      "type": "queueTrigger",
      "direction": "in",
      "queueName": "queue-trigger",
      "connection": ""
    },
    {
      "type": "queue",
      "direction": "out",
      "name": "output",
      "queueName": "queue-receiver",
      "connection": ""
    }
  ]
}

When i deployed the function, then I am getting the following error in logs present in monitor. enter image description here

2022-09-10T12:16:53.412 [Error] 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<storage account name>_STORAGE' does not exist. Make sure that it is a defined App Setting.

enter image description here

You can see I have defined, three application settings.

  • AzureWebJobs<storage account>_STORAGE
  • AzureWebJobsStorage
  • <storage account>_STORAGE

According to documentation, if connection is empty in function.json then AzureWebJobsStorage will be used.

Even i tried to set connection:"<storage account>_STORAGE", that also raised the same error.


Solution

  • I have reproduced in my environment, and the below workaround worked for me:

    I have created a storage account and copied the connection as below and i created a queue too over there as below enter image description here

    Then i pasted it in local.settings file in vs studio as below:

    enter image description here

    And now i published it too azure. Click on App setting in Configuration , if Connection string name is present then open that and paste the connection string. If not Then in published function app i created a connection string in application settings and copied the same connection string that i have taken from Storage account enter image description here

    enter image description here Then click on ok then save it. Then send message in queue as below: enter image description here And this workaround worked for me.