Search code examples
azureazure-sql-databaseazure-virtual-network

Azure SQL connection via Virtual Network Gateway


I've got working the ability to connect from my laptop using SQL Server Management Studio to managed Azure SQL sitting in a vnet, using virtual network gateway... BUT! I needed to add a hosts file record like below

10.0.1.4 myazuredb.database.windows.net

I'm using a private endpoint... which has an associated private DNS zone privatelink.database.windows.net.

I can see the A record in there pointing to 10.0.1.4 for myazuredb.

Is the hosts file record needed? As the private DNS zone is concerned with privatelink.database.windows.net as opposed to database.windows.net?

Ultimately is it expected that I need to have the local hosts file record to resolve 10.0.1.4 or should it just work without it and I've configured something wrong?

Thanks for any help :)


Solution

  • Yes, you need the hosts file in your current configuration. You can avoid having clients need to configure the hosts file if you roll your own DNS server or use Azure Private Resolver so that VPN clients can resolve the service. Take a look at the documentation for Azure Private Resolver.