Connect to Azure SQL database with Point to Site Connection and Private Link

MVP

Hallo,

 

I'd like to try to get the following done only somehow it doesn't seem to work
I have configured a Logical Server within Azure with VNet and Private Link enabled

edkreuk72_0-1588756119721.png

edkreuk72_1-1588756198236.png

 

Within this subscription I've a VM configured which you only get connected to when you have P2S connection enabled

Client makes Point to Site VPN to Azure with AAD Authentication.

When you connect with RDP to this VM with a private IP it is working fine. Connecting from this VM with SSMS to the Logical Server is working fine. Also the connection server.privatelink.databases.windows.net is working.

 

When customers opens SSMS on his own laptop from home, he cannot make the connection to this Private Endpoint link.

edkreuk72_2-1588756490026.png

 

The only way to solve this issue is to allow allow Public Network Access

edkreuk72_4-1588756590967.png

And to add the home ip-adress of the customer, but this is something we don't want, because then I've to add for everyone his home IP

 

edkreuk72_3-1588756568076.png

 

Is there another way to achieve the situation below. Did I missed something in the documentation.

 

 

edkreuk72_5-1588756727796.png

 

My End Goal what I want to achieve is. Connect to my sql server through a P2S without adding home ip-address from customers.

I've been reading the following link https://docs.microsoft.com/en-us/azure/sql-database/sql-database-connectivity-architecture#connectio... but then still my situation is not working.

 

Who can help me out. Thank in advance

 

 

12 Replies

@edkreuk72 

hi, have you managed to solve the issue ?

@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)

@edkreuk72  THAANKSS!!!!!!!!!!!! I was have the same problem and your comment helped me!! 

@edkreuk72 

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.

 

 

Hi @AlexBolo this solution works well for Sql Server Authentication. How to make it work with Active Directory Authentication. Any help will be apricated

@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,

In the connection string also you have to use privatelink in server name and TrustCertificate = true. Make sure that you are connected to correct VPN

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;

  • Hey @AlexBolo when you say enter username you mean the database login for the sql database?
This 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?
Thank 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.