Skip to content

Conversation

@alexwolfmsft
Copy link
Contributor

@alexwolfmsft alexwolfmsft commented Nov 17, 2025


// Set a credential for all clients to use by default
DefaultAzureCredential credential = new();
clientBuilder.UseCredential(credential);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this implementation needs to stay due to the custom client factory.

Copy link
Member

@scottaddie scottaddie Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsquire The AOAI client registration below should use the same DefaultAzureCredential. With that in mind, how do you advise we update this code sample?

@alexwolfmsft It doesn't need to happen in this PR, but the AOAI package should be replaced with OAI.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OpenAI registration should be updated, one of the ignored parameters from the factory is the credential to use:

lientBuilder.AddClient<AzureOpenAIClient, AzureOpenAIClientOptions>(
    (options, omgUseThisCredential, _) =>new AzureOpenAIClient(
                    new Uri("<url_here>"), omgUseThisCredential, options)); 

If we do that the right way, then we can keep or kill UseCredential because we're not relying on the closure scope.


// Set a credential for all clients to use by default
DefaultAzureCredential credential = new();
clientBuilder.UseCredential(credential);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants