Restricting access to Azure SQL from Azure VM - azure

Since Azure SQL have only DNS address and no IP , we can not enforce ACL's/NSG's on our Azure app VM as it needs to communicate with our Azure SQL..
ACL's/NSG's only have IP ranges restriction..no DNS restrictions..
So , potentially, a hacker who managed to sneak to our Azure App VM , can push its stolen data to what ever IP he wants as long as he is going out in port 1433.
Anyway we can restrict outbound communication from Azure VM only to our Azure SQL ?

You are correct, you can not place an Azure SQL Database within a Virtual Network (VNet). Also, you can only configure a NSG Outbound Security rule to use a Tag that restricts communication to Internet, Azure Load Balancer, or Azure Traffic Manager endpoint. So, unfortunately, it's currently not possible to restrict an Azure VM with NSG to only be able to communicate to a specific Azure SQL Database over Port 1433.
However, on the other side you can restrict the Azure SQL Database firewall rules to only allow your Azure VM to connect to the database by specifying it's IP Address in the SQL Database Firewall rules.

Related

Connect Azure SQL Server (PaaS) to a VM Scale set

How to connect Azure SQL Server (PaaS) to a VM Scale set. The Azure SQL Server has firewall and other network settings. I just want the common procedure like adding a VNet / subnet..
• With regards to network and firewall configuration, ensure that your Azure SQL Server has allowed inbound connections and traffic over SQL TCP port 1433 from the Azure VMSS if you are configuring this infrastructure in private, internal mode, i.e., within your specified virtual networks only.
• Connections between the same virtual network are allowed by default, thus if the Azure SQL server and the VMSS are in different virtual networks, then only the above connections are required. Also, ensure that outbound as well as the inbound traffic on the VMSS has been allowed on the above said TCP ports in the firewall and the NSG.
• Ensure that SQL Server allows connections over TCP ports, has enabled SQL Server authentication with a SQL login and password with permissions to access the hosted SQL database.
For more clarification, kindly refer the below documentation link for more details: -
https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/ways-to-connect-to-sql?view=azuresql#connect-to-sql-server-within-a-virtual-network
https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/connect-vm-instance-configure?view=azuresql
As above, you can configure a private endpoint for the Azure SQL Database server and then use the SQL Server Management Studio from the VMSS to access the SQL Database server from it using the private DNS FQDN of the private endpoint over the specified subnet only.
Similarly, as shown below in the snapshot, the virtual network subnet for the VMSS is also added as a rule in the selected networks section.

Azure SQL Database IP Firewall Rules - Restrict access to mi private network IPs

thanks in advance
I have the following scenario:
SQL database on a SQL Server on premise (source)
SQL database on aAzure (target)
I access to my network from a VPN (F5 - Big IP Edge Client)
I created and configured an Azure VPN Gateway to connect to the VPN. With this configuration and the use of Azure Data Factory, it is possible to see my on-premise database and read the data.
I want to restrict access to the Azure SQL database only to clients from my on-premise network (or connected to the VPN). When i try to set the firewall ip rules, Azure only allow to register public ips address but not recognice IPs from my onpremise network.
Questions
1)It is possible to set access to only clients from insede my private network. How to get this?
2)Is there another better option to get this secure connection?
Regards
SQL Azure maintains a firewall for the SQL Azure servers, preventing anyone from connecting to your server if you do not give their IP address permissions. Permissions are granted by client IP address. Any user’s desktop application that connected to SQL Azure would need to have the SQL Azure firewall open for them in order to connect. The client IP would be the IP address of the desktop machine as seen by the Internet.
Any desktop computer can access SQL Azure as long as it has Internet access, and port 1433 open for outbound connections.
If you're trying to connect from within a corporate network, you can add user machine public IP or the VPN endpoint IP if all user connect through it. Further to allow access from specific on-premises machines, firewall rules can be used to limit connectivity only to your public (NAT) IPs.
A more secure option, you can set up server-level firewall rules (Server-level IP firewall rules apply to all databases within the same server) and Setup database firewall rules (Database-level firewall rules only apply to individual databases, can be configured using Transact-SQL statements, and only after you've configured a server-level firewall rule.)
Create server-level and database-level firewall rules
Configure an Azure Active Directory (AD) administrator
Manage user access with SQL authentication, Azure AD authentication,
and secure connection strings
Enable security features, such as Azure Defender for SQL, auditing,
data masking, and encryption
Refer: Create firewall rules & Configure your client computers

How to connect to Azure pass DB from a secure network

I would like to connect to Azure SQL server from a Window server via SSMS. In the “set server firewall” from Azure, I have given my server IP ( from the system I would like to connect). I need to know the destination IP adders of the Azure DB Server. From Azure portal the location is showing central US . To allow firewall I need to know the destination IP address.
My questions are:
1. As Central US could have multiple IP addresses, do I need to provide all IPs to my Firewall team?
2. How can I know the destination IP address ( i.e. Azure) so that I can provide that to my firewall team?
Note: From SQL server management studio, the tcp default port for SQL is enabled and services are running fine.
Hope I have explained it correctly.Thanks
No. You cannot get a static IP address assignment for your Azure SQL Database. Moreover, what you refer (mysqlserverdatabase.mysql.database.azure.com designates your Azure SQL Database Server, not a single Database. This is a logical server, in which you can put up to 149 Databases (150 with the Master DB).
You have to workaround your requirement for static IP address assingment to work with the DNS Name (mysqlserverdatabase.mysql.database.azure.com).
Otherwise if your company firewall can't work with the DNS Name ,you need to set the server connection policy to Proxy as documented in Azure SQL Connectivity Architecture. This allows the database gateway to proxy all traffic between the client and the DB server. The gateways all have static IP addresses, which are listed in the above document.
If you have setup a VNet in Azure, checkout VNet Service Endpoints to connect Azure SQL.
https://azure.microsoft.com/en-in/blog/vnet-service-endpoints-for-azure-sql-database-now-generally-available/

NSG and routing details to connect a Microsoft Flow with Azure SQL database in a VNET

I have a SQL Server DB in a VM in a VNET in an Azure Subscription . Currently it does not have any connection open to the Internet .
My application team has designed a Microsoft Flow application that will read some emails , parse them in some way and push those files into the sql server database (local storage).
I cannot open my VM NSG to the entire internet. What NSG Rules do I need to implement?
The IP address from which Microsoft Flow requests are sent depends on the region where the environment that contains the flow is located. If you want to access SQL Database hosted on Azure VM from your Microsoft Flow application, you may whitelist these IP addresses.
Then you could follow these steps in how to open ports to a virtual machine with the Azure portal to open port 1433 and protocol. You have configured the outbound IP addresses above in the source IP addresses and dest port range 1433 in the inbound rule of NSG. Also, you need to ensure the same inbound traffic flow in VM itself firewall.

how to connect Microsoft Azure to on-premises sql database

Is it possible to connect a Microsoft Azure Web Site to a SQL Server Database hosted on-premises and, if so, what the steps that I need to follow?
Let any request in coming from you Azure Web Site IP and targeting TCP port 1433 through your firewall . Then change your connectionString on your Azure Web Site to point to the public gateway used on premsie.
As #qux mentioned, you need to allow for inbound traffic on port 1433. With Azure Web Sites, you won't have a dedicated outbound IP address, so you'll need to rely on a secure SQL Server configuration.
If you shift to Cloud Services (web role / worker role), then you will have an IP address to filter against. Same thing with Virtual Machines.
You can also set up a VPN (and there are many VPN appliances certified with Azure).

Resources