'Azure Functions how to get a new local.settings.json?

What I have been doing for some time now when using Azure Functions is to setup a local.settings.json file with where I configure settings like, ConnectionStrings, specific API's endpoints etc.

In the end I go to portal.azure.com -> MyFunctions -> Configuration -> Application Settings and add all my settings over there.

The thing is over time we get quite some settings that need to be configured, so the local.settings.json file grows as well.

But, suppose you are new and you have to work with this Functions project for the first time. How do you easily get that local.settings.json file without being depended on a co-worker that coincidentally has the file on his local drive?

So since you don't commit the local.settings.json file, how does one know what settings need to be configured?

Is it really the only option to take a look at the settings in portal.azure.com and re-create the local.settings.json file from scratch? Or is there a better way to solve this issue?



Solution 1:[1]

Run this from inside your local function app folder. It will create your local.settings.json file if it does not exist.

func azure functionapp fetch-app-settings <function app name>

Solution 2:[2]

Sorry for being late, but I wanted to leave here a script I have done to get the configs of a Function app or it slots (I needed to work with slots), format them with the local.settings.json file format and also resolve the keyvault values all at the same time.

I leave it here in case this helps somebody.

My problem was that this gets the settings in another format

az webapp config appsettings list

And this does not give me the configs of a specific slot

func azure functionapp fetch-app-settings

I just uploaded it in Github as I found this thread. Sorry for the poor Powershell standards as I am not an expert in PS scripting.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dave Neeley
Solution 2 Maximiliano Rodriguez