Azure Function Publish local.settings.json Value Formatting

vincent219 256 Reputation points
2021-09-16T06:26:22.977+00:00

I'm curious about the setup when publishing an Azure Function App via Visual Studio 2019.
Let's take an example local.settings.json.

{
  "IsEncrypted": false,
  "Values": {
    "MySetting1": "asdfsdf",
    "MySetting2": {
      "MySetting2-1": false,
      "MySetting2-2": false,
    }
    "MySetting3": [
      "asdfsadf",
      "asdfajlwsenr",
      "awerjlnwaesrsdfsd"
    ]
  }
}

How can I input through Visual Studio in the form above?
I found the method below, but do I have to set the config file only in the style below?

https://stackoverflow.com/questions/47025999/how-to-set-an-array-value-in-local-settings-json-file-in-azure-functions

"MySetting2:MySetting2-1": false,
"MySetting2:MySetting2-2": false,
"MySetting3:[0]:key1": "asdfsadf",
"MySetting3:[1]:key2": "asdfajlwsenr",
"MySetting3:[2]:key3": "awerjlnwaesrsdfsd",

Do I have to create each setting value in one line like the example in the link above?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
267 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2021-09-16T07:49:28.493+00:00

    @vincent219 The settings are key value pair and you cannot use value as arrays but you can define something value like array having key value pair. Yes your understanding is correct how you define in your example.

    "MySetting3": [  
          {  
            "key1": "value1",  
            "key2": "value2"  
          },  
          {  
            "key1": "value3",  
            "key2": "value4"  
          }  
        ]
    

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.