Azure App Configuration: Issues Overriding Non-Prefixed Keys with Prefixed Variants

Kyle Knapp 10 Reputation points
2023-12-28T09:18:25.3433333+00:00

Given an Azure App Configuration key with no prefix: Setting123, I am not able to override this key with a prefixed version of it Environment:Setting123.

This returns the key with the value from the non-prefixed key. If I don't execute TrimKeyPrefix then I see both values in the built config:

config.AddAzureAppConfiguration(options =>{    
options.Connect(new Uri(url), token)        
.Select(KeyFilter.Any)    
.Select($"{environment}:*").TrimKeyPrefix($"{environment}:");
});

If I add a prefix to the non-prefixed key, then the last one added takes precedence as expected:

config.AddAzureAppConfiguration(options =>{    
options.Connect(new Uri(url), token)        
.Select($"{commonPrefix}*").TrimKeyPrefix($"{commonPrefix}")    
.Select($"{environment}:*").TrimKeyPrefix($"{environment}:");
});

I'm seeking clarification as to if this is intended. I wasn't able to find any documentation that stated explicitly either way, but would expect it to have been called out if you are unable to override a non-prefixed key with a prefixed one.

Perhaps there are best practices that I am unaware of, would appreciate any guidance or input.

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
237 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,623 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.