Skip to content

Add msal4j dependency for microsoft entra authentication for SQL Server #24982

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukmanulhakkeem
Copy link
Contributor

@lukmanulhakkeem lukmanulhakkeem commented Apr 25, 2025

Description

Added the dependency https://mvnrepository.com/artifact/com.microsoft.azure/msal4j for Microsoft entra auth support

Motivation and Context

Git issue --> #25042

We are getting below error when setting authentication=ActiveDirectoryServicePrincipal in the sqlserver jdbc connection-url.

image

presto> show schemas from sqlserver;
Query 20250326_070238_00000_ah6qe failed: Failed to load MSAL4J Java library for performing ActiveDirectoryServicePrincipal authentication.
com.facebook.presto.spi.PrestoException: Failed to load MSAL4J Java library for performing ActiveDirectoryServicePrincipal authentication.
	at com.facebook.presto.plugin.jdbc.BaseJdbcClient.getSchemaNames(BaseJdbcClient.java:191)
	at com.facebook.presto.plugin.jdbc.JdbcMetadata.listSchemaNames(JdbcMetadata.java:90)
	at com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorMetadata.listSchemaNames(ClassLoaderSafeConnectorMetadata.java:223)
	at com.facebook.presto.metadata.MetadataManager.listSchemaNames(MetadataManager.java:303)
	at com.facebook.presto.connector.informationSchema.InformationSchemaMetadata.calculatePrefixesWithSchemaName(InformationSchemaMetadata.java:311)
	at com.facebook.presto.connector.informationSchema.InformationSchemaMetadata.getTableLayouts(InformationSchemaMetadata.java:270)
	at com.facebook.presto.metadata.MetadataManager.getLayout(MetadataManager.java:370)
	at com.facebook.presto.sql.planner.iterative.rule.PickTableLayout$PickTableLayoutWithoutPredicate.apply(PickTableLayout.java:211)
	at com.facebook.presto.sql.planner.iterative.rule.PickTableLayout$PickTableLayoutWithoutPredicate.apply(PickTableLayout.java:176)
	at com.facebook.presto.sql.planner.iterative.IterativeOptimizer.transform(IterativeOptimizer.java:246)
	at com.facebook.presto.sql.planner.iterative.IterativeOptimizer.exploreNode(IterativeOptimizer.java:187)

Impact

Test Plan

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

== RELEASE NOTES ==
SQL Server Connector Changes
* Add support for Microsft Entra authentication with msal4j

@lukmanulhakkeem lukmanulhakkeem requested a review from a team as a code owner April 25, 2025 10:07
@lukmanulhakkeem lukmanulhakkeem force-pushed the sqlserver_msal4j_dep branch 2 times, most recently from d537e2a to 60f4246 Compare April 29, 2025 10:01
@ZacBlanco
Copy link
Contributor

ZacBlanco commented Apr 30, 2025

Also, can you please paste the error stacktrace as text rather than a screenshot. It makes searching for the issue easier in the future

@ethanyzhang ethanyzhang added the from:IBM PR from IBM label May 2, 2025
@prestodb-ci prestodb-ci requested review from a team, nishithakbhaskaran and jp-sivaprasad and removed request for a team May 2, 2025 00:02
@prestodb-ci
Copy link
Contributor

Saved that user @lukmanulhakkeem is from IBM

@prestodb-ci
Copy link
Contributor

@ethanyzhang imported this issue into IBM GitHub Enterprise

@nishithakbhaskaran
Copy link
Contributor

@lukmanulhakkeem Please update the release note according to the guildlines https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines

@nishithakbhaskaran
Copy link
Contributor

@lukmanulhakkeem I prefer you can also create an issue for this and tag it here under motivation and context which will be easy for tracking the issue in future

@ethanyzhang
Copy link
Contributor

I used ChatGPT to extract the stacktrace text from the image

@lukmanulhakkeem lukmanulhakkeem force-pushed the sqlserver_msal4j_dep branch from 60f4246 to 0ca20c1 Compare May 5, 2025 10:53
@lukmanulhakkeem
Copy link
Contributor Author

@nishithakbhaskaran I created an issue and mentioned it in the description. Release note is not needed for this. So updated the same in the body.

@lukmanulhakkeem lukmanulhakkeem requested a review from ZacBlanco May 5, 2025 11:02
Copy link
Contributor

@ZacBlanco ZacBlanco left a comment

Choose a reason for hiding this comment

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

@lukmanulhakkeem Is it possible to write a test for this so we can verify that it actually works as expected?

@lukmanulhakkeem
Copy link
Contributor Author

lukmanulhakkeem commented May 6, 2025

@ZacBlanco If we need to test the property authentication=ActiveDirectoryServicePrincipal, we need to configure a datasource with Microsoft Entra authentication, which requires a Microsoft account. Is it possible in our testing environment ?

@ZacBlanco
Copy link
Contributor

You should try to look into it and see if there are any docker containers available that we can run to test this

@lukmanulhakkeem
Copy link
Contributor Author

@ZacBlanco Microsoft Entra authentication is a cloud-based mechanism that requires a Microsoft account for setup. Is this feasible in the open-source context?

@ethanyzhang
Copy link
Contributor

@tdcmeehan Do we have precedent for setting up test account for scenarios like this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from:IBM PR from IBM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants