Connection to Azure SQL database on Azure Private Link/Endpoint using Azure VPN Client not working - azure-sql-database

I'm trying to setup an Azure SQL database using P2S VPN for users who are remote working. They are using some applications like SSMS and Visual Studio that require access to the database. We allow them to connect by white listing their IP addresses but we would like to stop this and to use the deny public network access option on the SQL server on Azure.
Whenever I try to connect using SSMS I get the following message:
I've followed the steps outlined in the documentation and tutorials on MS Docs but I have not been able to get the private endpoint to work with the database.
I have created the virtual network gateway and connected it to Azure Active Directory and I can see the sessions being created by the users as they log in.
I have created the virtual network using the address range = 10.1.0.0/16 and the subnet address range = 10.1.0.0/24. I have attached the private endpoint connection to the Azure SQL server and added the virtual network to the firewall.
Is there some setting required to allow the user to connect to the database from their PC without whitelisting IP addresses?

WAY 1:
You may Use domain name instead of IP directly from your virtual
network. So, you need some service in Azure which can translate domain
name to IP.
It is necessary to properly configure your DNS settings to resolve the private endpoint IP address to the fully qualified domain name (FQDN) of the connection string.
Use a DNS forwarder for on-premises workloads to resolve the FQDN of a private endpoint, to resolve the Azure service public DNS zone in Azure.
A DNS forwarder is a Virtual Machine running on the Virtual Network
linked to the Private DNS Zone that can proxy DNS queries coming from
other Virtual Networks or from on-premises. This is required as the
query must be originated from the Virtual Network to Azure DNS.
.
Use the host file on a virtual machine to override the DNS: Azure
creates a canonical name DNS record (CNAME) on the public DNS. The
CNAME record redirects the resolution to the private domain name
(privatelink.database.windows.net). You can override the resolution
with the private IP address of your private
endpoints. See azure-provided-name-resolution.
References:
Azure services DNS zone configuration and
on-premises-workloads-using-a-dns-forwarder
Refer this for connectivity troubleshooting using Private Link
See how to resolve-azure-internal-dns-from-your-on-prem-network
WAY 2 :
You may go for SQL managed instance which is another Azure SQL
PaaS offering .It is deployed with in VNet with no public service
endpoints and uses root and client certificates to authenticate in
azure.
(Go for this when one prefers not to use Private endpoint:)
To configure P2S VPN using certificates Refer :
configure-p2s-vpn-using-certificates-and-connect-to-sql-managed-instance-from-on-premise-machine.
Other references:
DNS-Client-Configuration-Options
DNS-Integration-Scenarios
DNS-Scenario-Using-AD

Related

No access to Azure Storage Account which has virtual network only access, despite a succesful Point2site connection to that virtual network

I want to restrict access to my Azure storage account to selected networks only (please see image).
Current network restriction setting
My current set up is as follows:
I have an Azure Storage account, with blob containers and tables.
Only selected networks can access this storage account (please see the first image above). I've selected the gateway subnet (I've tried to add other subnets within the same virtual network, to no avail).
I have selected a virtual network call. All service endpoints for this network are set up correctly ('storage-service endpoint' is 'succesful'). The subnet involved is gateway subnet.
I also have a virtual gateway which is placed inside this virtual network. With (of course) the gateway subnet assigned to it.
Subnet endpoint permission
I have a point2site VPN connection (using Azure VPN client) to connect to this virtual network from my local machine (see image below).
This connection has been set up as well, using Active Directory as authentication method. All seems correctly working.
The virtual gateway to which the VPN connects, can see the active connection (see image below)
Obviously, I'm doing something wrong, so any help is very much welcome!
Regards,R.
VPN connection details
I have a point2site connection to the virtual network that is granted access to this storage account (see images below).
The point2site connection looks good (see image below), but I still can't access the storage account.
Current connection in azure VPN client
Current view of active connection to Virtual Gateway that connects to this Vnet.
Any help is much appreciated!
I tried to reproduce your scenario that can be possible with setting the private end point in storage account and azure VPN client.
you need to create and configure a Private End Point under the subnet you have the storage account exists.
Go to 'Private Endpoint Connection' under settings of storage account in azure portal as below:
Connected with Vnet using Azure VPN client .
Now you can map network drive on this pc using this format
\\Private IP Address or FDQN \Filesharename
For me there is one blockage.it error: Unable to reach the Azure storage account via port 445. I can’t add port 445 in my system if you have port number 445 you can be able to access the file share if not add port 445 so the SMB traffic over this port.
Note: Disable the firewall/ anti-virus temporarily installed on your computer.
Reference: https://learn.microsoft.com/en-us/azure/storage/files/storage-troubleshoot-windows-file-connection-problems

Azure - Private Link Between Virtual Networks

I have two virtual networks: public and private. On the public vnet there is an app service. On the private vnet there is an azure sql database. The azure sql database has public access blocked and is exposing a private link. The two vnets are peered. The private dns zone for the private link has both vnets linked.
When I VPN to the private vnet I can connect to the private link no problem. When I try to connect via the app service I get an error:
SqlException: Reason: An instance-specific error occurred while establishing a connection to SQL Server. Connection was denied since Deny Public Network Access is set to Yes (https://learn.microsoft.com/azure/azure-sql/database/connectivity-settings#deny-public-network-access). To connect to this server, use the Private Endpoint from inside your virtual network (https://learn.microsoft.com/azure/sql-database/sql-database-private-endpoint-overview#how-to-set-up-private-link-for-azure-sql-database).
It seems like the app service is using the public IP address (thus the error) as opposed to seeing the private IP address (via the private dns zone).
How can I set up the azure app service to connect via private link across vnets?
Update: My app service is using Docker. I ssh'ed into it and saw that the dns name was resolving to the public IP address. I temporarily added the IP to the hosts file (the private IP), but I still get the same error.
This smells more like a networking or DNS issue rather than specific to Private Link on the Azure SQL DB.
As you can SSH into your App container, can you try some network tests from there such as TRACERT to see whether it is resolving the private IP correctly and also has a suitable route in place between the virtual networks.
Haver you also checked NSGs on each virtual network to ensure that port 1433 is alloed to pass between them?
On the configuration page of your app service you need to add the following app settings:
WEBSITE_DNS_SERVER with value 168.63.129.16
WEBSITE_VNET_ROUTE_ALL with value 1

Provide access to Azure Sql from vnet only

I've got vnet in Azure 10.1.0.0/24. VM connected to vnet directly by static ip: 10.1.0.5 and has not public endpoint. I connect to vnet using VPN and able to connect to VM. That wokrs fine.
I'd created Azure Sql database and want to limit connection only from vnet 10.1.0.0/24 (no public endpoint). So, my VM should be able to connect to Azure Sql and I shoul be able to connect to it when connected through VPN.
How can I configure this?
In this case, if you have set up a private connection to Azure – via P2S VPN, S2S VPN, or Express Route, then you can use a TCP proxy server to forward traffic to the public IP address for SQL Database because the virtual network rules are not supported VPN scenario, read the limitation and this.
Main Steps:
You can add Azure VM vnet&subnet to virtual network rule on SQL Database as described here
Download Nginx and change only the body the nginx.conf file without modifying headers to forward any traffic received on port 1433 to your SQL Database server sqlserver.database.windows.net:1433.
You could read this blog for more details.

Access Azure SQL Database when connected to VNET via Client Gateway

I have an Azure Virtual network and I connect to the network using Point-to-point with the VPN client downloaded from Azure. This works as expected as I can now RDP to VMs in the VNet if required.
I also have an Azure SQL Server instance and in the firewall section I have added the VNet above to the Virtual networks rule list.
With my work laptop, I was now hoping that I would be able to connect to the VNet using the VPN client and then be able to access the SQL database using SSMS. However, when I try and connect I get a message telling me that I cannot access the server and instead need to add my client IP to the Firewall rule list, which is what I was trying to avoid doing.
Is there something else I need to be doing here to get this working?
Is there something else I need to be doing here to get this working?
If you just use an Azure SQL Database, which is a Paas in Azure, itself is not located inside a VNet. You can directly add the client Public IP in the firewall of Azure SQL Server. Whereas this is not your expectation. You need to make it inside a VNet, then you can do these followings.
If you are using a SQL Managed instance which located inside a VNet, want to access the Database instance from on-premises with a private address, you need to make a VPN connection or ExpressRoute connection between the on-premise and the Managed Instance VNet.
Now, you have a P2S VPN connection, you still need to make VNet peering with Gateway Transit between the P2S VNet with SQL instance VNet. Note: To use remote gateways or allow gateway transit, the peered virtual networks must be in the same region. To do so, make the following very specific changes under the Peering settings.
In the VNet that hosts the VPN gateway, go to Peerings, then to the
Managed Instance peered VNet connection, and then click Allow
Gateway Transit.
In the VNet that hosts the Managed Instance, go to Peerings, then to
the VPN Gateway peered VNet connection, and then click Use remote
gateways.
Once the peering complete, you can check the status on the Azure portal. You need to remove the VPN client and re-download it and re-install it on your laptop, this will make the route update on your client side.
If you've established on-premises to Azure connection successfully and you can't establish a connection to Managed Instance, check if your firewall has an open outbound connection on SQL port 1433 as well as 11000-12000 range of ports for redirection.
For more reference, you can read Connect your application to Azure SQL Database Managed Instance.

What will be the DNS name for Virtual Machine instance created in IBM Bluemix?

I have created a Virtual Machine in Bluemix. I have installed NGINX web server on it. To access the web application that is deployed on NGINX, should I use a public IP address (for e.g. http://123.456.78.9) or is there a domain name associated with the instance (something like http://abcxyz.bluemix.net)?
When you launch any VM in cloud by default they should be not accessible from public internet unless you attach a public ip address to them.
Once you have attached a public ip address to your instance and configured the firewalls to allow incoming connections (http, ssh etc) you can update your DNS server to redirect traffic there.
AWS create a public FQDN at the time of launching the ec2 instances as
ec2-nn-nn-nn-nn-region-compute.com (where nn are ip address bits), not sure any similar thing with bluemix but it is less likely to have abcxyz.bluemix.