-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify experience when using endpoint-based connection: leverage DefaultAzureCredential
by default
#547
Comments
Hi @julealgon, the only thing I'm worried about here is the dependency on Introducing a separate package does seem like kind of a big deal as well if it's just for convenience. That might make releasing new versions easier, but we'd need to actively track the |
Thanks @amerjusupovic . I will say... we just hit another hurdle because of this due to key vault references... now we are also forced to add this (in my opinion incredibly unnecessary): .ConfigureKeyVault(kv => kv.SetCredential(new DefaultAzureCredential()); I just don't see why things like this are not the default setting. Not only we have to specify it explicitly, but it also looks incredibly redundant considering we just specified that credential for the appconfig instance itself on the This API surface is not as user friendly as it could be ATM. |
I kind of agree with @julealgon. @zhenlan @drago-draganov what's your take on this? |
Here are my thoughts.
|
If you think it should always be explicit like that, then I believe the class should be renamed to something else other than I don't consider this "magic" behavior. It is just a sensible default. If it could not be overridden, then I'd agree with you.
Some of these issues seem like problems on the SDK side? Debugging challenges and performance overhead should be able to minimized at the library side, surely? I also hope the perf overhead is only on the first access, as the information is cached. If that's not the case I'd be a lot more worried about it and would like to know. Regarding "unpredictable behavior", to me, that's a super weird way of saying "being configurable using environment variables", which to us is an obviously beneficial feature. Without support for environment variables, I have no safe way to provide I'm a bit surprised such absurd argument (IMHO) is in the official docs.
You could easily create a separate package that contained the base AzureAppConfig library plus Many Microsoft libraries are built this way, so again it surprises me the team here sees that as some sort of big challenge. In any case, I do hope the team changes its mind eventually. I'd like to avoid having to maintain custom extension methods/private nugets to streamline the API. I wish I didn't have to. |
The
Connect(Uri, TokenCredential)
API forces the consumer to always specify a token credential, which to me seems fairly unnecessary considering we have a very sane default called theDefaultAzureCredential
class.I propose one (or 2) of the following:
IConfiguraitonBuilder.AddAzureAppConfiguration
that takes just aUri
object, and usesnew DefaultAzureCredential
behind the scenes.AzureAppConfigurationOptions.Connect(Uri, TokenCredential)
method to make thetokenCredential
argument optional: if it is not specified, default tonew DefaultAzureCredential
AzureAppConfigurationOptions.Connect(Uri, TokenCredential)
that takes only theUri
argument and defaults the credential internally tonew DefaultAzureCredential
I believe this would significantly streamline configuration, especially when you connect to multiple instances like we do. This is currently our implementation for context:
And this is how it would look like with option 1 above:
PS: The reason we fetch the endpoint from configuration itself is because we have dedicated instances of Azure AppConfig for each of our environments.
I'm aware this would add a new dependency to
Azure.Identity
on the package (since every single implementation ofTokenCredential
comes from there) but to me that seems fully justifiable and I'd even make the argument that it would simplify this interaction even more to the consumer as he doesn't need to be aware of a separate package that needs to be introduced to even be able to call these endpoint-based overloads.If the team is somehow concerned over this new dependency addition, then I'd propose this new overload exist as part of a separate
Microsoft.Extensions.Configuration.AzureAppConfiguration.Identity
package that references bothMicrosoft.Extensions.Configuration.AzureAppConfiguration
andAzure.Identity
. I personally think that would be overkill, however.This expands:
And apparently is somewhat of a "rollback" of this?
Looks like at the time there were some nasty dependencies on NewtonsoftJson and System.Interactive.Async that don't exist anymore in
Azure.Identity
.The text was updated successfully, but these errors were encountered: