How to get nested object from local.settings.json to isolated C# function code?

krishna572 886 Reputation points
2023-04-06T17:28:10.4+00:00

local.settings.json

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
  },
    "Functions": {
      "Client1": {
        "QueueName": "devqueue"
      }
    }
}

Function Code: (.NET 7 Isolated )

 public void Run([QueueTrigger("%Functions:Client1:QueueName%", Connection = "AzureWebJobsStorage")] string myQueueItem)
{
}

Error: The 'QueueTrigger' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.QueueTrigger'. Microsoft.Azure.WebJobs.Host: '%Functions:Client1:QueueName%' does not resolve to a value.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
Developer technologies C#
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2023-04-10T21:42:27+00:00

    vaishu-143 Thanks for posting your question in Microsoft Q&A. Unfortunately, this is not supported, and you need to use Values to define your settings as described in this thread. Notes, Values must be string and not JSON objects or arrays and refer doc: Local settings file. Also, refer Azure Queue storage trigger doc for more details on the usage of QueueTrigger. User's image

    Currently, the binding expressions are resolved by the host, and a feature request #1253 was open to support configuration sources registered with the worker based on discussion #1238. I suggest you follow the item on the updates or feel free to submit a new issue in repo azure-functions-dotnet-worker.

    I hope this helps with your question and let me know if you have any other.


    If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

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.