-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Improve client registration guidance #49938
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
Improve client registration guidance #49938
Conversation
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Show resolved
Hide resolved
There was a problem hiding this 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
DefaultAzureCredentialbehavior - 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>
Summary
Describe your changes here.
Fixes #Issue_Number (if available)
Internal previews