Forum Discussion
T‑SQL Magic Command (%%tsql) Error in Microsoft Fabric Notebook on Fabric SQL Database
Hi khanjaved,
Thank you for testing across different workspaces, capacities, and even a new trial environment. Since the same %%tsql command works in another tenant but consistently fails in this tenant with the error "SSL Provider: certificate verify failed: self-signed certificate in certificate chain", this indicates the issue is not related to your notebook syntax or artifact usage. Instead, it points to a tenant-specific Fabric runtime or SQL Database connection trust configuration issue, where the notebook runtime is unable to validate the SQL Database certificate.
Please ensure the notebook is using the Python execution engine, restart the notebook session, and establish the connection using the session parameter as shown below:
%%tsql -artifact sqldb1 -type SQLDatabase -session
SELECT 1
Also, make sure the SQL Database and notebook are in the same workspace and the database artifact is properly attached to the notebook. If the issue still persists, since it works correctly in another tenant, this will most likely require tenant-level investigation by the Fabric engineering team, as the SSL trust validation is managed internally by the Fabric runtime environment rather than notebook code.
Hope this clarifies. Let us know if you have any doubts regarding this. We will be happy to help.
Thank you for using the Microsoft Fabric Community Forum.
Hi khanjaved,
Just checking in to see if the issue has been resolved on your end. If the earlier suggestions helped, that’s great to hear! And if you’re still facing challenges, feel free to share more details happy to assist further.
Thank you.
- khanjaved6 months agoMicrosoft Employee
v-kpoloju-msft I have alredy tried below cmd, this is also not working,
%%tsql -artifact sqldb1 -type SQLDatabase -session SELECT 1
For SSL trust validation, Is there any documentation what fabric or tenant team need to change?
- v-kpoloju-msft6 months agoCommunity Support
Hi khanjaved,
Thank you for confirming that the session based %%tsql command also fails with the same SSL error.
In Microsoft Fabric, notebook connections to SQL Database use secure, platform-managed connectivity where authentication, encryption, and certificate validation are handled internally by the Fabric service. There are no tenant-level settings available to manually configure or override SSL certificate trust.
Since you have confirmed the same command works in another tenant but fails in this tenant even with newly created workspaces, SQL databases, and notebooks this helps isolate the behaviour to the tenant environment rather than notebook syntax or artifact configuration. In this case, it would be appropriate to engage your internal Microsoft support channel or create a support request so the Fabric team can further investigate the tenant-specific runtime and connectivity behaviour.
Thank you again for using the Microsoft Fabric Community Forum.
- v-kpoloju-msft6 months agoCommunity Support
Hi khanjaved,
Just checking in to see if there has been any update on this issue after engaging the Microsoft support channel. Could you please confirm whether the issue has been resolved? If it is resolved, we would appreciate it if you could share the resolution or key insights here, as it may help other community members facing similar issues.
Thank you.