How to use QueueTrigger with connection string in nested configuration?

Phillip Ashworth 0 Reputation points
2025-05-31T05:03:34.06+00:00

I am trying to run an Azure Function v4 locally with a nested configuration object in local.settings.json:

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
        "App__QueueName": "aqueue",
        "App__ConnStr": "UseDevelopmentStorage=true",
        "App__Foo": "Bar"
    }
}

Then in my QueueTrigger attribute I am using the nested config as follows:

[Function("MyFunc)]public async Task Run([QueueTrigger("%App:QueueName%", Connection = "App:ConnStr")]	string message){}

Which gives me the error:

[2025-05-31T04:41:34.344Z] Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.MyFunc'. 
Microsoft.Azure.WebJobs.Extensions.Storage.Queues: Storage account connection string 'AzureWebJobsApp:ConnStr' does not exist. 
Make sure that it is a defined App Setting.

I have tried using double underscores in the QueueTrigger but it makes no difference.

It seems that the queue name is being correctly resolved with this syntax but not the connection name - any ideas how to use nested configuration for the connection name?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RithwikBojja 3,055 Reputation points Microsoft External Staff Moderator
    2025-06-02T03:50:26.65+00:00

    Hi @Phillip Ashworth ,

    I do agree that, it works for me too using below code and configurations:

    using System;
    using Azure.Storage.Queues.Models;
    using Microsoft.Azure.Functions.Worker;
    using Microsoft.Extensions.Logging;
    
    namespace FunctionApp2
    {
        public class Function1
        {
            private readonly ILogger<Function1> rithlger;
            public Function1(ILogger<Function1> logger)
            {
                rithlger = logger;
            }
            [Function(nameof(Function1))]
            public void Run([QueueTrigger("%test:name%", Connection = "test:rithconstr")] QueueMessage message)
            {
                rithlger.LogInformation($"Hello Rithwik, the message is : {message.MessageText}");
            }
        }
    }
    

    local.settings.json:

    {
        "IsEncrypted": false,
      "Values": {
        "AzureWebJobsStorage": "",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
        "test__rithconstr": "DefaultEndpointsProtocol=https;AccountName=rithwik9b2e;AccountKey=YawnJjrithwiktestCw==;EndpointSuffix=core.windows.net",
        "test__name": "rithq"
    
      }
    }
    

    Output:

    enter image description here


    If this answer was helpful, please click "Accept the answer" and mark Yes, as this can help other community members.

    enter image description here

    If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.