Little confused what are the best practices for creating and disposing KeyVaultClient objects.
I am currently instantiating KeyVaultClient in the following way:
var azureServiceTokenProvider = new AzureServiceTokenProvider();
_keyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback), httpClient);
I am currently creating httpClient using an injected IHttpClientFactory. What does KeyVaultClient actually do if I don't supply the HttpClient? I assume it is creating it's own instance of HttpClient, but how does it manage that instance?
KeyVaultClient implements IDisposable. Obviously under the hood KeyVaultClient is using a HttpClient instance and I have heard in many places that its not a good idea to dispose of HttpClient after each usage (say a single GET call). Does this mean I should be avoiding the disposing of KeyVaultClient as well as it will dispose my provided httpClient instance?
Any clarification on this would be great.