question

MelindaDeSeranno-9585 avatar image
0 Votes"
MelindaDeSeranno-9585 asked ·

Unable to connect to Azure SQL DB from SSMS

I've set-up a new azure server and database. I've added my ip address to the firewall but none of my user ids are working to log in. I may be entering the wrong syntax.

azure-sql-database
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.

MelindaDeSeranno-9585 avatar image
0 Votes"
MelindaDeSeranno-9585 answered ·

I was able to log in:

I went to Home > SQL databases and clicked on the database in question. I checked the connection string listed there.

My user id was different that the syntax I am used to it actually had me include the server name as part of my user id. For example
my name@gmail.com@my server name

I also downloaded the sdks listed below for the various connections as well (ADO, OBDC etc).

· 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 @MelindaDeSeranno-9585, we are glad it worked out for you. You can mark your answer as 'Accept Answer'

0 Votes 0 ·
MelindaDeSeranno-9585 avatar image
0 Votes"
MelindaDeSeranno-9585 answered ·

Here is the specific error

75116-image.png



image.png (22.6 KiB)
·
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.

AnuragSharma-MSFT avatar image
0 Votes"
AnuragSharma-MSFT answered ·

Hi @MelindaDeSeranno-9585, welcome to Microsoft Q&A forum.

From the error message it looks the user you are trying to login with does not exist in the database. There are couple of ways to login to Azure SQL Database through SSMS:

1). Use the admin credentials that were used to create the Azure SQL Server service. Please refer to below screenshot for the same. We provide the admin credentials as mentioned in yellow highlighted box. We can then use the same in the SSMS to login.

75284-image.png


2). Creating another user through below commands after you login to SSMS using admin credentials:


 --Run this in master database
    
 CREATE LOGIN newuserlogin
 WITH PASSWORD = 'password@123';

 --Run this in database you want to create the login user in
    
 CREATE USER newuserlogin
 FROM LOGIN newuserlogin
 WITH DEFAULT_SCHEMA=dbo;

After creating the login user you can use the same values for login again in SSMS. Also mention the database name where you created the user as shown in below screenshot:

75452-image.png

Please be notified that these will work only when you added the ip address to the firewall of Azure SQL Server. You can check the same like below:

75218-image.png

Please let me know if this helps or else we can discuss further.



If answer helps, please mark it 'Accept Answer'



image.png (88.8 KiB)
image.png (72 B)
image.png (42.3 KiB)
image.png (45.9 KiB)
· 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.

The problem is that I can't get in to the database at all from SSMS so I would not be able to run the sql query you list above. I've tried to create a user in Azure and tested those credentials as well and they don't work. I think my issue is something basic like not using the right login syntax. Should I be using the full login - myname@gmail.com or just 'myname' ? I'm not sure why the error reads - Cannot open server 'gmail.com'

0 Votes 0 ·
RajkumarV-2449 avatar image
1 Vote"
RajkumarV-2449 answered ·

Hi, You would also face this error if you do not provide the database name in the SSMS options

75461-image.png



image.png (23.8 KiB)
· 2 ·
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.

Thanks @RajkumarV-2449 for providing the screenshot. Somehow in my answer screenshot did not appear even though I pasted it. I edited it and pasted it back. Really appreciate your inputs

1 Vote 1 ·

I have done that as well but it doesn't connect to the database in order to retrieve it.

0 Votes 0 ·