Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sajugeorge
New Contributor

Can i connect from powershell to fabric datawarehouse sql endpoint?

Hi,
I am trying to connect to fabric datawarehouse SQL endpoint using powershell to execute a sql command. Is the below method correct?

sajugeorge_0-1693599916194.png


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.

4 REPLIES 4
DennesTorres
Valued Contributor

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

HimanshuS-msft
Contributor III

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.

Helpful resources

Announcements
Top Solution Authors
Top Kudoed Authors
Users online (11,584)