[QUERY] KeyVaultCredentialPolicy Makes Extras Requests #23556
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
KeyVault
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone
Query/Question
I am not really sure if this is a Question, Bug or Feature.
Whle working recently with Azure (specifically Azure Key Vault product), we noticed that we always get double requests when we want to
get
orset
a given Secret adding a lot to the latency of the requests. Half of them are 401 responses while the other half is 200.That seemed to be a quite strange behaviour and we decided to go deeper into it.
Turned out, this behaviour is on the
KeyVaultCredentialPolicy
which always makes an extra request. Checking code, I can see some comments aboutchallenge based auth
. This Policy (and several others) are automatically included when you build aSecretClient
and there is no easy way to add/remove the policies I want.With all that info, I would like to understand the benefits of having the "challenge based auth" and if we can avoid it by our own risk.
I managed to configure my own
pipeline
overriding it and providing only aBearerTokenAuthenticationPolicy
. The main problem I could see is that I have to provide a hard-coded scope (https://vault.azure.net/.default
in my case) while theKeyVaultCredentialPolicy
extract it from the header (www-authenticate
) of the first response. The other downside is that I loose all the other Policies configured before, for exampleUserAgentPolicy
andRetryPolicy
.ex:
Why is this not a Bug or a feature Request?
I am not sure if this is a Bug, Feature Request or by design, hence I think this is primarily a question.
The text was updated successfully, but these errors were encountered: