Ebeid ElSayed
Ebeid ElSayed

Reputation: 1156

Can't connect to Azure SQL database from Visual Studio

When I try to open my Azure SQL Server database in Visual Studio enter image description here

and then use my Azure user account (I already added this user to SQL Owner role) [email protected] I got the following error

Cannot open server "DomainName.com" requested by the login. The login failed. (Microsoft SQL Server, Error: 40532)

Upvotes: 5

Views: 17963

Answers (4)

user2284063
user2284063

Reputation: 321

Just to summerize the above:-

  • I went to the Azure database Connection Strings and selected ODBC.
  • Then I used the value from Server= for the server and from Uid= as the username and my password and it worked.
  • If this doesn't work, check the firewall.

Upvotes: 3

Ricardo Conte
Ricardo Conte

Reputation: 151

In my case the problems were:

  1. I had forgot to add a firewall rule stating I could access the database from my IP address; when you get to the firewall rules it shows your current IP address and a line to create a rule. There is also a button that say "add the client IP" or similar, just click it.

Also I forgot to save the rules (there is a not that clear "save" button or string in the top right above the rules)

  1. I was using id + password as [email protected] + mypass; I would get a complain about not able to access "... .hotmail. I changed tue aID to my name only.

  2. Also I was not using the full string "tcp:my-database-name.database.windows.net,1433" I guess it is necessary, not sure.

Fixed the 3 points above it worked.

Upvotes: 1

Ebeid ElSayed
Ebeid ElSayed

Reputation: 1156

It seems to be I need to use [email protected]@AzureSQLInstanceName as a user name, and my domain password as password. I got that from the database connection strings section on Azure portal.

Upvotes: 15

viperguynaz
viperguynaz

Reputation: 12174

Make sure you've added the IP address you are calling from the to SQL Firewall: Your Server >> Settings >> Firewall Settings.

Upvotes: 4

Related Questions