Skip to content
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

[QUESTION] Can I auth jdbc with service principal id and certificate(either a file or path)? #1666

Closed
jiahh-ms opened this issue Oct 8, 2021 · 3 comments · Fixed by #2128
Labels
Enhancement An enhancement to the driver. Lower priority than bugs. Question Used when a question is asked, as opposed to an issue being raised

Comments

@jiahh-ms
Copy link

jiahh-ms commented Oct 8, 2021

Question

Hi,

I'm working on connect sql database with jdbc using service principal auth, and exploring if we can use a certificate instead of secret.

In this doc page it says it needs a SP id and a secret when the auth type is setting to SP.
I verified this option works and now trying to see if we can connect sql db using jdbc with SP id and a certificate, from either a path or binary content. The SP is from a AAD app I created and cert is created from a AKV signed by me. I'm trying to upload the cert to the AAD app and use this access sql db.

Can some one please tell me if this is supported and how?

And we are doing this this because we are trying to mimic how a AAD app use MSI to connect to SQL.
I created a Azure VM and I'm able to use the MSI created by VM to access SQL.
But I'm not sure on a random machine how can a AAD app get this MSI and use it to connect SQL with jdbc.

If you know the answer for either please let me know. Thank you!

Regards,
Jiaheng He

@jiahh-ms jiahh-ms added the Question Used when a question is asked, as opposed to an issue being raised label Oct 8, 2021
@lilgreenbird
Copy link
Contributor

hi @jiahh-ms

I’m not sure if you are looking for the Client Certificate Authentication feature? Here are some sample test code which use this feature.

Also, the JDBC driver does support MSI authentication via the property authentication=ActiveDirectoryMSI . You can see sample code on how to use that here.

@jiahh-ms
Copy link
Author

Thank you for the response! Closing this since we get reply from email. Will follow up from there, thanks!

@lilgreenbird
Copy link
Contributor

just to clarify, currently the JDBC driver does not support AD service principal and certificate authentication.

@lilgreenbird lilgreenbird added the Enhancement An enhancement to the driver. Lower priority than bugs. label May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement An enhancement to the driver. Lower priority than bugs. Question Used when a question is asked, as opposed to an issue being raised
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants