Isolated functions(v4, .Net 7) Default project does not pull through config

57 Views Asked by At

I have tried the solutions in multiple cases I have seen this question,

I have created a fresh template project to try and get it working simplistically but it still doesn't.

Local settings file:

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
        "AppConfig": "https://asdasd.io"
    }
}

Program.cs

var host = new HostBuilder()
    .ConfigureFunctionsWorkerDefaults()
    .ConfigureAppConfiguration((host, builder) =>
    {
        builder.AddJsonFile(Path.Combine(host.HostingEnvironment.ContentRootPath, "local.settings.json"),
            true,
            true);


    })
    .ConfigureAppConfiguration((host, builder) =>
    {
        var connectionString = Environment.GetEnvironmentVariable("AppConfig");
        var connectionString2= host.Configuration.GetSection("Values");
    })
    .Build();

host.Run();

The File exists in the correct debug folder so it is being copied, but I cannot for the life of me get these env vars to pull through.

This has worked fine with previous in-process versions

0

There are 0 best solutions below