I asked yesterday where to store the connection string for a CosmosDBTrigger. It worked great until I had to push it up to Azure. Now the function isn't working at all. It works locally just fine though. There is no difference between codebases so the only thing I can think of is the connection string isn't be pulled from local.settings.json
when on Azure. I mean, it wouldn't surprise me if that was the case since the file has the word local
in it.
I tried putting the contents in the host.json
, but that didn't work either.
How do you specify the connection string when your Function is running on Azure?
local.settings.json
is not used in Azure. Instead, settings are taken from App Service Settings .
For your yesterday's example, go to Function App's Application settings
tab and add a value with key DbConnString
there.
If you are using func
CLI, you can publish settings from local.settings.json
file to Azure Application settings by running
func azure functionapp public <App> --publish-local-settings
You need to put it in the Application Settings for the function app. These can be setup using the Azure Portal or deployed as part of the ARM template I believe.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.