Facing issues to connect with synapse workspace/azure sql db via oauth
I want to connect to and access my Synapse Workspace and SQL Pool using OAuth. For this purpose, I have created an app in Azure and assigned the following API permissions:
- Microsoft Graph:
- Directory.Read.All (Delegated)
- Directory.ReadWrite.All (Delegated)
- Directory.AccessAsUser.All (Delegated)
- User.Read
- User.Read.All
- User.ReadWrite
- Azure Storage:
- user_impersonation (Delegated)
- Azure SQL Database:
- user_impersonation (Delegated)
I am requesting access tokens with the following parameters:
- Authorization URL:
https://login.microsoftonline.com/<tenant-id>/oauth2/authorize
- Token URL:
https://login.microsoftonline.com/<tenant-id>/oauth2/token
- Scope:
-
https://graph.microsoft.com/.default
-
https://management.azure.com/.default
-
https://storage.azure.com/user_impersonation
-
https://sql.azuresynapse-dogfood.net/user_impersonation
-
With these parameters, I am able to obtain access tokens. However, when I use these access tokens to connect to my Synapse Workspace and Azure SQL Database via SQLServerDriver with the connection property accessToken
set to the fetched access token value, I receive the following error:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user '<token-identified principal>'. Incorrect or invalid token.
I would like to add that with username and password i could connect to workspace and sql pool so we can rule out connectivity issues
2 answers
Sort by: Most helpful
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more