Skip to content

Add actionable error message for missing Azure package when Entra ID auth methods are used#4046

Merged
cheenamalhotra merged 1 commit intomainfrom
dev/ad/rework-3962
Mar 13, 2026
Merged

Add actionable error message for missing Azure package when Entra ID auth methods are used#4046
cheenamalhotra merged 1 commit intomainfrom
dev/ad/rework-3962

Conversation

@apoorvdeshmukh
Copy link
Contributor

Description

Fixes #3962.

Issues

#3962

Testing

Added unit test

Guidelines

Please review the contribution guidelines before submitting a pull request:

@apoorvdeshmukh apoorvdeshmukh requested a review from a team as a code owner March 13, 2026 15:56
Copilot AI review requested due to automatic review settings March 13, 2026 15:56
@github-project-automation github-project-automation bot moved this to To triage in SqlClient Board Mar 13, 2026
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 the error message when users attempt to use Active Directory (Entra ID) authentication methods without having the required Microsoft.Data.SqlClient.Extensions.Azure NuGet package installed. Previously, the error simply said "Cannot find an authentication provider for '{method}'", which was not actionable. Now it explicitly tells users to install the Azure extensions package.

Changes:

  • Changed SQL.CannotFindAuthProvider to accept SqlAuthenticationMethod enum instead of string, and return a more helpful error message for Active Directory auth methods that includes the package name and NuGet URL.
  • Added a new resource string SQL_CannotFindActiveDirectoryAuthProvider with actionable guidance.
  • Added unit tests covering both Active Directory and non-Active Directory authentication methods.

Reviewed changes

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

Show a summary per file
File Description
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs Changed CannotFindAuthProvider parameter from string to SqlAuthenticationMethod and added switch to return AD-specific error message
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs Updated call site to pass enum directly instead of .ToString()
src/Microsoft.Data.SqlClient/src/Resources/Strings.resx Added new SQL_CannotFindActiveDirectoryAuthProvider resource string
src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs Auto-generated property for the new resource string
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/SqlUtilTests.cs New unit tests verifying error messages for both AD and non-AD auth methods
Files not reviewed (1)
  • src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs: Language not supported

You can also share your feedback on Copilot code review. Take the survey.

@apoorvdeshmukh apoorvdeshmukh added this to the 7.0.0 milestone Mar 13, 2026
@paulmedynski paulmedynski moved this from To triage to In review in SqlClient Board Mar 13, 2026
@paulmedynski paulmedynski added the Area\Azure Connectivity Use this to tag issues that are related to Azure connectivity. label Mar 13, 2026
@paulmedynski paulmedynski self-assigned this Mar 13, 2026
Copy link
Contributor

@benrr101 benrr101 left a comment

Choose a reason for hiding this comment

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

Going forward, make sure that if you are reworking a PR to do the reworking in the same PR. If you close and resubmit a PR, all the comment history is wiped out, and it bypasses the requirement for a blocking review to be resolved before merging.

This was referenced Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Azure Connectivity Use this to tag issues that are related to Azure connectivity.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Azure split] Non-actionable error message if only the base package is referenced

6 participants