In SSMS you used "Azure Active Directory" authentication.
I couldn't test it, but in SqlCmd see you have to add parameter -G (use Azure Active Directory for authentication)
See https://learn.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-ver15#syntax
SQL Server Management Studio Connect to Another Database using :Connect
Nemo1234567
1
Reputation point
Hi,
Using SQL Server Management Studio, I'm able to connect to a database by using the GUI as below
But I'm unable to do so by executing ":connect". I've turned on the SQLCMD mode. I'm not sure whether is it because I didn't specify the authentication mode. If this is required, pls kindly let me know the syntax. Thks!
2 answers
Sort by: Most helpful
-
Olaf Helper 43,246 Reputation points
2022-03-22T08:55:53.55+00:00 -
Nemo1234567 1 Reputation point
2022-03-23T07:40:15.697+00:00 I've appended "-G" at the end of the command but it didn't work as well
The error is as below