For the life of me I cannot find much official information on the load order or precedence of configuration file load order.
I have a situation where I am provided configuration via AddAzureKeyVault which is fine, but I also have a local user secrets json setup which contains a connection string that I want to overwrite the key vault provided one.
The example Configuration setup looks like so:
builder.Configuration
.AddAzureKeyVault(someKvUri, new DefaultAzureCredential())
.AddEnvironmentVariables();
#if DEBUG
builder.Configuration.AddUserSecrets("some-id");
#endif
The hope here is in a Debug build it will allow the developer to overwrite whatever settings they want from the provided ones with whatever is local in the user secrets, be it variables, connection strings etc.
Problem is it doesn't work and there is seemingly no documentation detailing the load order of these 2 things when used together. The KV always takes precedence so its not overwriting the values.
I have put in some other whimsical values in the user secrets and can see them being added to the Configuration object, so I know its being loaded, and if I comment out the AddAzureKeyVault line then I get my user secret values populated, however it feels like the local user secrets should take the maximum precedence here.
I have also tried moving the AddUserSecrets above the key vault registration bit, and setting reloadOnChange to true/false, neither alters behaviour.
So is there a way to have the user secrets overwrite whats provided by the KV? without going into the scenario we cannot use appsettings.Development.json to overwrite stuff it has to be done via some other file/mechanism, and it was agreed user secrets would be the better way to allow individual developers to re-point certain resources to use local ones, i.e sql servers, cosmos dbs, queues etc.
== Edit 1 ==
As per comments here is some more information:

As you can see the user secrets are loaded as the 2nd value is present in the config, however the first value is not present, the only one present for that key is the KV one which is ConnectionStrings--TheKeyName.
So from what I can see here the KV is overwriting the user secret value, and it doesnt matter if I load the KV before or after the secrets. Also just to confirm if I were to remove the KV loading then I correctly see the user secret first value in the configuration.
IConfigurationinstance in a debugger, you can see the providers in order: check that. IME the precedence is 100% driven by the order providers are added to the builder (remember you can.Clear()to remove the default included providers).AddUserSecretsbeforeAddAzureKeyVault