-
Notifications
You must be signed in to change notification settings - Fork 434
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
Managed Identity dev experience improvements #1936
Conversation
…mssql-jdbc into jdbc-msi-improvements
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.
There is one other change we need to make to align the JDBC driver with other drivers. We should deprecate the msiClientId get/set methods (but they should continue to work. Comment: "Use the getUser/setUser method instead.") This will include changing the Authentication=ActiveDirectoryMSI validation to allow specifying User in the connection string. If both msiClientId and User are specified, User should override msiClientId.
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSecurityUtility.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSecurityUtility.java
Outdated
Show resolved
Hide resolved
…user property for managed identity client ID
…mssql-jdbc into jdbc-msi-improvements
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSecurityUtility.java
Outdated
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.
please run formatter looks like a lot of these files aren't formatted
boolean isAzureFunction = null != identityEndpoint && !identityEndpoint.isEmpty() && null != identityHeader | ||
&& !identityHeader.isEmpty(); | ||
throw new SQLServerException(SQLServerException | ||
.getErrString("R_ManagedIdentityTokenAcquisitionFail"), null); |
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.
can we add more info to the error message to make it easier to debug when there's a failure
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.
Similarly, do we have more info if the Optional task fails or doesn't return a result? I don't know the API well...
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.
What additional info did you have in mind? I'll amend the error message to the following to be more clear as to the reason it is null.
Failed to acquire managed identity token. Request for the token succeeded, but no token was returned. The token is null.
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.
Not sure. From the sounds of it, we don't have anything more available. The current iteration looks good.
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSecurityUtility.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
Outdated
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.
Partial review
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java
Outdated
Show resolved
Hide resolved
boolean isAzureFunction = null != identityEndpoint && !identityEndpoint.isEmpty() && null != identityHeader | ||
&& !identityHeader.isEmpty(); | ||
throw new SQLServerException(SQLServerException | ||
.getErrString("R_ManagedIdentityTokenAcquisitionFail"), null); |
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.
Similarly, do we have more info if the Optional task fails or doesn't return a result? I don't know the API well...
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSecurityUtility.java
Outdated
Show resolved
Hide resolved
@David-Engel For some reason there's no "reply" button for your comment. I'll just quote you and reply here.
If the Optional task fails, it will throw its own error. The resulting exception, since we're using the Azure Identity credentials, will be a A
Howerver, there isn't any more available information other than a null token if the Optional succeeds (eg. request for token went through but a null token was returned). In this case, as you suggested (since we shouldn't return null), we'll throw our own error. |
Signed-off-by: Jeff Wasty <[email protected]>
PR Resolves the following:
Deprecated the following:
New authentication property values:
authentication=ActiveDirectoryManagedIdentity
EDIT: Later changed toauthentication=DefaultAzureCredential
authentication=ActiveDirectoryDefault
New environment variables:
INTELLIJ_KEEPASS_PATH
ADDITIONALLY_ALLOWED_TENANTS
(comma delimited list of additionally allowed tenant IDs, used withDefaultAzureCredential
)To use the IntellijCredential with the driver, supply the connection string property
authentication=DefaultAzureCredential
and set theINTELLIJ_KEEPASS_PATH
environment variable to the path of the keepass database.