Reputation: 3129
I can see two json files(host.json and local.settings.json) has been added in Azure Function directory.
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingExcludedTypes": "Request",
"samplingSettings": {
"isEnabled": true
}
}
}
}
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
What is the purpose of having these two json files?
Upvotes: 32
Views: 41996
Reputation: 608
Host.json is to set configs once you deploy Azure function on Azure. You can relate it to app.config/web.config. for example, you may need to define a AzureWebStorage connection string for a Storage in Azure for fucntion to run. Any other appsetting must be defined here too.
Whereas local.settings.json defines local settings which you will use for your development. For example AzureWebstorage defined is pointing to local storage. This file will be ignored during deployment. This is akin to your dev config file.
Upvotes: 9
Reputation: 222592
It is very clearly explained in the documentation , from the docs,
The host.json metadata file contains global configuration options that affect all functions for a function app. This article lists the settings that are available starting with version 2.x of the Azure Functions runtime.
The local.settings.json file stores app settings, connection strings, and settings used by local development tools. Settings in the local.settings.json file are used only when you're running projects locally.
Upvotes: 28