Hello @Haoran Bai
The login error you're seeing:
Cannot open database "db_presentation" requested by the login. The login failed.
indicates that the user synapseadm@synapse-haoran-test-ws
does not exist as a valid Azure Active Directory (AAD) principal in your Synapse workspace.
To fix this:
- Please verify the exact Azure AD user or service principal name that your JDBC connection uses to authenticate.
- Then, run the following commands in the Serverless SQL pool (using Synapse Studio) to create that user in the
db_presentation
database and grant it read permissions:
USE db_presentation;
GO
CREATE USER [<AAD_user_or_service_principal>] FROM EXTERNAL PROVIDER;
GO
ALTER ROLE db_datareader ADD MEMBER [<AAD_user_or_service_principal>];
GO
Replace
<AAD_user_or_service_principal>
with the exact Azure AD identity used by your connection (for example,******@___domain.com
or a service principal name).
Once this is done, your Spark notebook connection should succeed without login errors.
Reference:
https://learn.microsoft.com/en-us/azure/synapse-analytics/security/how-to-set-up-access-control
https://learn.microsoft.com/en-us/sql/t-sql/statements/create-user-transact-sql?view=azure-sqldw-latest
https://learn.microsoft.com/en-us/azure/azure-sql/database/authentication-aad-overview?view=azuresql
https://stackoverflow.com/questions/78305589/how-to-grant-user-permission-to-a-specific-database-in-azure-synapse-analytics-l/78306259?utm_source=chatgpt.com
If this is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.
Let me know if you have any further Queries.