# Quickly Restore your Local Settings File for Azure Functions

If you've ever worked with Azure Functions then no doubt you've seen the local.settings.json file before. This file stores app settings, connection strings, etc. for local development.

It looks like the following to refresh your memory:

{
  "IsEncrypted": true,
  "Values": {
    "FUNCTIONS_EXTENSION_VERSION": "VALUE",
    "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "VALUE",
    "WEBSITE_CONTENTSHARE": "VALUE",
    "AzureWebJobsDashboard": "VALUE",
    "AzureWebJobsStorage": "VALUE",
    "ConsumerKey": "VALUE",
    "ConsumerSecret": "VALUE",
    "OAuthTokenSecret": "VALUE",
    "WEBSITE_TIME_ZONE": "VALUE"
  },
  "ConnectionStrings": {}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

This file is also by default not checked into source control. If you open your .gitignore file you'll see the following:

#### Ignore Visual Studio temporary files, build results, and
#### files generated by popular Visual Studio add-ons.

# Azure Functions localsettings file
local.settings.json
1
2
3
4
5

With this knowledge, you might have a need one day to restore this file (for example, working with the source code on another machine pulled down from source) and you can easily do so.

Simply install the Azure Functions Core Tools (opens new window) with npm install -g azure-functions-core-tools.

Navigate to the source code where your Azure Function is and run func azure account list. This will ask you to login and you should ensure we are in the proper subscription where your Azure Function exist. You'll see something like the following:

C:\Users\mbcrump\src\FunctionTest>func azure account list
Subscription                                                                 Current
------------                                                                 -------
Visual Studio Enterprise (xxx)                                               True
Michael's Internal Subscription (xxx)                                        False
1
2
3
4
5

If you're not in the right subscription then type func azure account set <subid> where subid is the correct subscription.

Now run func azure functionapp fetch-app-settings <functionname> where functionname is your Azure Function and it will restore your local.settings.json file!