Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi,
I am trying to connect to fabric datawarehouse SQL endpoint using powershell to execute a sql command. Is the below method correct?
I am getting "login failed with invalid authentication method".
can you please share a sample?
The firewall is open. I can connect using SSMS to the fabric datawarehouse SQL endpoint from the same box and login to azure with same account.
Hello @sajugeorge
Thanks for using the Fabric community.
I think the powershell script works when you have the sql end point under your subscription . I just did a simple search for the sql end point on the azure portal under my suuscription and its not there . To me at this time, it looks you cannot query SQL EP from powershel , I will reach out to the internal team to confirm that .
Thanks
HImanshu
Thanks Himanshu. Please keep me posted on progress.
Hi,
I haven't tried this yet, but I can add some details.
Is the Get-AzAccessToken opening an interactive login window? If not, probably this is why it's failing. It's expecting that you use Connect-AzAccount before this command, to interactive sign in. The token will be retrieved from your login.
If your plan is to make a non-interactive script, you would need an app registration.
Some links which may help:
https://svitla.com/blog/azure-sql-database
https://thomasthornton.cloud/2020/10/06/query-azure-sql-database-using-service-principal-with-powers...
https://gist.github.com/ehrnst/e34b54d61718405552839532db48734c
Kind Regards,
Dennes
Hi Dennes,
Yes! it opens interactive login with MFA. Same as SSMS login window (which opens interactive login with MFA). SSMS login works and connection is made. Powershell isthrowing the above error.
Thank you