I have an isolated worker function in .net 8 that i want to use appsettings.json for all the configuration (NOT Environment Variables). Why? Because we use appsettings.json in the other three projects in this solution and we want this managed in the same way, we need to deploy to 100+ function apps and i do not want to script environment variable changes in that way. I want to use the appsettings.json file in a similar configuration to how we’ve always used it with regular .net 6 apps.
This function for example
public async Task ProcessPasswordResets([QueueTrigger("password-resets", Connection = "ConnectionStrings:PrimaryFileStorage")] ResetPasswordMessage message, FunctionContext fc)
….
Will never fire even though there is a queue with the name “password-resets” at the storage account using connection string “PrimaryFileStorage” in a node called “ConnectionStrings” in the appsettings.json.
having a “flat” local.settings.json file with similar setup works fine.
Adding storage services or other connections in Program.cs using something like _config[“ConnectionStrings:PrimaryFileStorage”] works fine as well. It seems the only place it can’t navigate away from “AzureWebJobsStorage” (default connection string) is the declaration of the QueueTrigger in the function call method itself.
This is a windows Azure Function app that is relying on timer and queue triggers mostly. When i use Env Variables everything works, but i REALLY do not want to, finding it hard to understand why the isolated-worker functions seem to have such issues and wondering if it’s a bug?
I’ve tried everything, flattening the appsettings.json file, trying every conceivable configuration in Program.cs. I am at the point where i think i should just revert this back to .net 6 and roll the dice they will figure it out in a year.
Mike McKinnon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.