can't override appsettings.json settings with environment variables

Remove the ASPNETCORE_ prefix from your env variables or add it as a parameter to AddEnvironmentVariables, there's no prefix by default.

Edit: Try enumerating the config to see if the keys are lining up as you'd expect.

private static void ShowConfig(IConfiguration config)
{
    foreach (var pair in config.GetChildren())
    {
        Console.WriteLine($"{pair.Path} - {pair.Value}");
        ShowConfig(pair);
    }
}

I was on the same boat as you and I figured out a few things that might help you and everybody else having the same headache.

First of all, as mentioned on the other answer, you do not need any prefix. So both ASPNETCORE_ and AppSettings are unnecessary, unless you pass them as prefix into AddEnvironmentVariables(). So simply go azure:password.

Secondly you do not necessarily need double underscore to make an env var that maps nested appsettings value. Just go with a single colon.

Example:

This one in appsettings:

"azure": {
  "password": "my.weak.azure.password"
}

can be overridden by this environment variable:

enter image description here

Lastly, the values added to Environment Variables on Windows are apparently cached by Visual Studio or its background processes like Console Window Host. Closing and reopening Visual Studio would get you the new values. That is why you noticed seeing them after restarting your machine.

enter image description here