Azure / azure-functions-on-container-apps

Docs , samples and issues for Azure Functions on Azure Container Apps
MIT License
74 stars 18 forks source link

Not automatically reading app settings from local.settings.json #20

Closed lilyjma closed 1 year ago

lilyjma commented 1 year ago

Had a function app with HTTP trigger and worked fine when tested locally following the instructions in the readme.

Added an Event Hub trigger, and because of that added an app setting to local.settings.json. Started to get errors when testing locally.

First error: image

So I passed in as an environment variable to docker run the event hub connection string info.

First error went away, but got a second error:

image

So I passed in as an environment variable to docker run Azure Storage connection string info. (The value for AzureWebJobsStorage)

Then I got the app running fine locally. Based on this, it seems that HTTP trigger works because it didn't need to access Azure Storage. But once I added the Event Hub trigger, it needed that access as well as that of the Event Hub namespace. The app wasn't reading "local.settings.json" and instead, I had to pass in the connection info as environment variables when running the docker container.

raorugan commented 1 year ago

Yes @lilyjma , the connection settings and secrets need to be configured using below command az functionapp config appsettings set --name --resource-group --settings AzureWebJobsStorage=""

The above is the case for public manaed azure functions as well cc// @lpapudippu