Forum Discussion
Connect to Azure SQL database with Point to Site Connection and Private Link
giladdan, yes we got this finally working. By adding the ip-adress and names from the private endpoint to the local hostfile of my laptop(or co workers)
- Hector MuñozJul 21, 2022Copper Contributor
edkreuk72 THAANKSS!!!!!!!!!!!! I was have the same problem and your comment helped me!!
- edkreuk72Sep 25, 2022MVPGreat to hear that Hector
- AlexBoloNov 10, 2022Copper Contributor
I found an easier way to Connect to SQL DB with P2S.
After you have Created your VPN Gateway and Private Endpoint Connection for SQL DB, on the client machine in SSM login Window you will need to Enter at the servername the IP Address of your SQL Endpoint Connection and the user name should be entered like this: username @ yourdatabasename.privatelink.database.windows.net
In Options Enable Trust Server Certificate and Encrypt Connection also Enabled. Afterwards you will have access to the DB directly from your local Client via P2S Connection.
I hope this helps!
Cheers Alex.
- Herald_Go_SisonFeb 28, 2023Copper Contributor
edkreuk72 Have you encountered problem connecting from your visual studio/azure data studio via connection string to the database? i am having a problem connecting to it with point to site VPN enabled but with SSMS i have no problem at all, your solution helped me a lot. Only this connection string is bugging me off a lot right now,
- MayankGaur1985Feb 28, 2023Copper ContributorIn the connection string also you have to use privatelink in server name and TrustCertificate = true. Make sure that you are connected to correct VPN
- Herald_Go_SisonFeb 28, 2023Copper Contributor
Hi Sir, do you mean like this sir?
Server=companydb.privatelink.database.windows.net;Initial Catalog=CompanyDB;User ID=fakeuser @ companydb.privatelink.database.windows.net;Password=faketesttest;TrustServerCertificate=True;
- andyduffyApr 07, 2023Copper ContributorThis totally worked.... as soon as I put 10.0.1.4 mydatabase.database.windows.net into my hosts file on pc.... why is it needed though? Just for my learning? Because otherwise you're effectively in the vnet with no way to resolve the name to the internal IP would be my guess?
- BenOmalleyJul 17, 2023MicrosoftThank you very much for this, I spent a couple of days trying to find out how to get my VNET gateway working for our Azure SQL DBs and finding this comment was the missing piece that I needed.