We help IT Professionals succeed at work.

Azure SQL Connection String not working

Murray Brown
Murray Brown asked
on
Hi

I just added a new SQL database to my Azure account. For some reason the connection string provided isn't working.
What might cause this?

Thanks
Comment
Watch Question

Pawan KumarDatabase Expert
Awarded 2016
Top Expert 2016

Commented:
What connection string you are setting. See this link how you can get the actual connection string -

https://www.experts-exchange.com/questions/29065679/restructure-connection-string-for-Azure.html

once you get the connection string just change the line where you are setting the connection.
Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
In Azure they provide a connection string as follows

Server=tcp:xxxx.database.windows.net,1433;Initial Catalog=xxxxxx;Persist Security Info=False;User ID=xxxxx;Password=xxxxx;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
Senior Developer
Commented:
Do you connect from the same IP? Otherwise you need to set a firewall rule.
Top Expert 2016
Commented:
sample connection strings
test azure connnection stringsTest in visual studio
ste5anSenior Developer

Commented:
And when you connect from SSMS, you need to set the database in the Options dialog of the Login window.
Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
Thanks Ste5an. Yes I am connecting from the same IP address
Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
Thanks David. I got my connection string from a similar looking screen in Azure
Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
Thanks for the help