question

RishabhKumar-1573 avatar image
0 Votes"
RishabhKumar-1573 asked ·

Login failed for user

I am running the script as mentioned below via batch file and I am getting error.

Script:
sqlcmd -S servername.company.edu -U first.last@company.edu -P password
-G -s "|" -i "c:\Users\fl1\Desktop\Test.sql" -o "c:\Users\fl1\Desktop\output.txt"


Error:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed for user ''


Can someone advise what could be the issues here? Since I have tried the double quotes, single quotes, and no quotes around username and password but none worked.

azure-sql-databaseazure-batch
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @RishabhKumar-1573, welcome to Microsoft Q&A forum.

**(-G )**is used for Azure Active Directory Authentication. Could you please confirm if you set the user(first.last@company.edu) as the Active Directory Admin for the Azure SQL Server?

Also can you please try running the same from command window once and see if you are getting the similar error?

After I set up the Azure Admin I was able to run the command successfully.

0 Votes 0 ·

0 Answers