Skip to content

Conversation

@alexwolfmsft
Copy link
Contributor

@alexwolfmsft alexwolfmsft commented Nov 17, 2025

@alexwolfmsft alexwolfmsft marked this pull request as ready for review November 21, 2025 19:02
Copilot AI review requested due to automatic review settings November 21, 2025 19:02
Copilot finished reviewing on behalf of alexwolfmsft November 21, 2025 19:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves client registration guidance by clarifying that DefaultAzureCredential is automatically applied when using AddAzureClients, reducing unnecessary boilerplate code and preventing confusion about credential setup.

Key changes:

  • Removed redundant explicit UseCredential(new DefaultAzureCredential()) calls from code samples where credentials weren't being reused
  • Added explanatory comments in samples that retain explicit credential creation to clarify when and why manual credential creation is needed
  • Updated documentation to explain the implicit DefaultAzureCredential behavior
  • Improved error handling in subclient registration with explicit null checking via pattern matching
  • Updated code highlight ranges to reflect the modified code structure

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
docs/azure/sdk/snippets/pagination/Program.cs Removed redundant UseCredential call since credential isn't reused elsewhere
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs Added clarifying comments about implicit credential creation, improved subclient registration with pattern matching for null handling, updated variable naming from queue to queueName
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs Added clarifying comments about implicit credential creation, improved subclient registration with pattern matching for null handling, updated variable naming from queue to queueName
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs Added clarifying comments about implicit credential creation, improved subclient registration with pattern matching for null handling, standardized comment text with other samples
docs/azure/sdk/snippets/authentication/local-dev-account/Program.cs Removed redundant UseCredential call from the simple registration example
docs/azure/sdk/snippets/authentication/credential-chains/Program.cs Removed redundant explicit credential creation and UseCredential call from basic example
docs/azure/sdk/snippets/aspnetcore-guidance/MinApiSample/Program.cs Removed redundant UseCredential call since credentials aren't reused
docs/azure/sdk/snippets/aspnetcore-guidance/BlazorSample/Program.cs Removed redundant UseCredential call and associated comment
docs/azure/sdk/logging.md Updated description to clarify that DefaultAzureCredential is applied automatically
docs/azure/sdk/dependency-injection.md Updated explanatory text to clarify implicit credential behavior, removed redundant UseCredential calls from configuration examples, updated code highlight ranges
docs/azure/sdk/authentication/best-practices.md Updated example description to clarify the implicit credential usage, removed code highlighting from the simplified example
docs/azure/sdk/aspnetcore-guidance.md Updated code range references to reflect modified snippets, revised explanation to clarify implicit credential behavior

Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
@scottaddie scottaddie merged commit 6f7409d into dotnet:main Nov 21, 2025
9 checks passed
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