Control outbound IP address of internal VMSS in Azure - azure

I have a VMSS/svc fabric cluster on internal vnet (not public). The only inbound connections to the VMSS is from on prem through a Azure VPN Gateway.
How do I control the outbound IP address the VMSS go through when accessing the internet? In this case I do not want this traffic routed through a random IP address or through the VPN connection.
Basically I want to secure my Azure SQL so that the outbound internet IPs of the VMSS is whitelisted. And I don't want to add all Azure datacenter IPs.

You could look to use Forced Tunneling which would ensure that your control where the data egress occurs in your on-premises environment, however this would force any data in your Virtual Network back over your VPN connection which may not be desirable (or helpful if you don't control egress from there).
Failing this you could add a software-based firewall running on an Azure VM with a public IP onto the same VNet and then use User Defined Routes (UDRs) to force all traffic bound for the Internet to go via that and then use the public IP address in your SQL firewall.
Longer term you will be able to connect Azure SQL DB to VNets (or at least restrict access to it from one) - see the Uservoice site (and add your vote!)

Related

Azure Firewall: How to translate Internet URL to Internal/Intranet URL?

I have created the following Vnets
vnet-hub-poc-hubspoke is the Hub Vnet
and both the Vnets are peered as per the HUB-SPOKE model
vnet-hub-poc-hubspoke being a Hub Vnet, it has Azure firewall configured
both the Vnets are connected to Azure Private DNS
Azure Private DNS has a record pointing to the VM deployed on the vnet-prod-poc-hubspoke Vnet
and I could access the FQDN within the internal network
after adding the below rule in Azure Firewall, I could access the website using the firewall public IP
Now, instead of firewall public IP I want to use the domain name like
http://myfirstweb.private.landingzonedomain.com/ (for now, I have updated the hosts file in the client machine pointing to firewall public IP)
what should I do at the azure firewall level so that it would translate Internet URL to Internal/Intranet URL like
http://myfirstweb.private.landingzonedomain.local/
What you want is not possible, because you cannot assign a domain name to your Azure Firewall. What you could do is to create a DNS record at a domain name provider that translates a custom domain to your Azure firewall public IP.
Although I have seen people routing inbound traffic in their vnet, Azure firewall is mainly designed for controlling outbound traffic and traffic flowing between (peered) vnets. When you want to direct inbound traffic to a website or service inside your vnet, you can choose between:
Application Gateway
Frontdoor
Combination of both
All the options above allow you to add custom domains and certificates. On the other hand, when you want to access a virtual machine through rdp or ssh, your main options are:
Bastion host (i.e. jumpbox)
VPN
Cloud Shell

How to route all traffic through Azure Firewall in Azure, even on Prem( connected with VPN)

In our Azure tenant we have a Azure Firewall and a VPN connection with our on prem servers. I want to route all traffic through the azure firewall, whether it's incoming traffic from on prem to azure or outgoing traffic from azure to on prem.
For traffic inside azure I have created a routing table for each subnet and pointed to the firewall. Is this correct? And what do I have to configure for the on prem connection part. Further, how can I test it?
Thanks and best regards
To route traffic coming from the on-prem network, through the Azure Firewall, you also need to specify a route on the "GatewaySubnet".
This route table should contain the (Azure) subnets you want to reach from on-prem.
So if you for example have a subnet 10.5.5.0/24 in Azure, and you want to reach that from On-Prem.
Add a route table, with a route to 10.5.5.0/24, next hop type "Virtual Appliance" and Next Hop IP the private IP of your Azure Firewall.
Add this route table to the GatewaySubnet. (Some times you cannot assosiate from within the route table itself, but have to to through Virtual Network > Subnet and specify the route table there.
(And allow the traffic in the Azure Firewall.)

Is there a VPN solution in Azure that can assign a static public IP to the clients connected for me to achieve full tunnelling? may be in P2S VPN?

Is there a VPN solution in Azure that can assign a static public IP to the clients connected for me to achieve full tunnelling? may be in P2S VPN?
P2S VPN does not have full tunneling. Is there any other alternate solution?
• No, you can’t assign a static public IP address to the clients for a VPN solution in Azure as the client address pool that needs to be defined while deploying a VPN gateway in Azure is a subnet of the IP address spaces that the virtual network is created out of.
But you can configure forced tunnelling in your Azure virtual network on your VPN gateway subnets as illustrated below. In the below image, forced tunnelling is shown for Site-to-Site VPN scenario but it can also be implemented for Point-to-Site VPN scenarios in the same way. The Frontend subnet is not force tunneled. The workloads in the Frontend subnet can continue to accept and respond to customer requests from the Internet directly. The Mid-tier and Backend subnets are forced tunneled. Any outbound connections from these two subnets to the Internet will be forced or redirected back to an on-premises site via one of the Site-to-site (S2S) VPN tunnels as shown below.
This allows you to restrict and inspect Internet access from your virtual machines or cloud services in Azure, while continuing to enable your multi-tier service architecture required. If there are no Internet-facing workloads in your virtual networks, you also can apply forced tunneling to the entire virtual networks.: -
• Also, please note that you can *configure the above for your P2S clients by securing the Internet traffic via Firewall Manager and advertising the 0.0.0.0/0 route to your VPN clients. This makes your clients send all internet bound traffic to Azure for inspection. Then, firewall SNATs the packet to the PIP of Azure Firewall for egress to Internet. For this purpose, setup the Azure Firewall Policy to allow P2S traffic to Internet and to advertise all the traffic from 0.0.0.0/0 to your VPN clients, you would need to break them into two smaller subnets 0.0.0.0/1 and 128.0.0.0/1 as mentioned in the below documentation: -
https://learn.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-p2s-advertise-custom-routes#forced-tunneling
Also, you can add the code below in your ‘azurevpnconfig.xml’ file that can be directly downloaded from the templates section if the above said subnets cannot be added in ‘Default Routes’ on the portal.
<clientconfig>
<includeroutes>
<route>
<destination>0.0.0.0</destination><mask>1</mask>
</route>
<route>
<destination>128.0.0.0</destination><mask>1</mask>
</route>
</includeroutes>
</clientconfig>

How do I know that a Virtual Machine in Azure use the Local network gateway route to connect to an on-premise network?

Here a Data engineer who needs your help to setup a connection to an on-premise environment :)!
I have created a virtual network (10.0.0.0/16) with a default subnet (10.0.0.0/24).
Then I created a (Windows) virtual machine which is connected to the vnet/subnet and has allowed ICMP inbound and outbound rules for the ping test. Ping google.com is no problem.
The next step was to create a Virtual network gateway & Local network gateway to connect to an on-premise environment.
The Local network gateway has an Site-to-site (IPsec) connection to a VPN device from a third party (over which I have no control). Status in the Azure portal = 'Connected'.
The third party is able to ping the Virtual Machine in Azure, the 'data in' property on the VPN connection shows that 2 kb (ping) has been received. So that works!
When i try to send a ping command to the ip-address (within the 'address space' specified from the Local network gateway) the ping command fails (Request timed out.).
After a lot of searching on google/stackoverflow I found out that I need to configure a Route Table in Azure because of the BGP = disabled setting. So hopefully I did a good job configure the Routing Table Routes but still I can't perform a successful ping :(!
Do you guys/girls know which step/configuration I have forgotten or where I made a mistake?
I would like to understand why I cannot perform a successful ping to the on-premise environment. If you need more information, please let me know
Site-to-site (IPsec) connection screenshot/config
Routing Table setup screenshot/config
Routing Table Routes in more detail
If you are NOT using BGP between the Azure VPN gateway and this particular network, you must provide a list of valid address prefixes for the Address space in your local network gateway. The address prefixes you specify are the prefixes located on your on-premises network.
In this case, it looks like you have added the address prefixes. Make sure that the ranges you specify here do not overlap with ranges of other networks that you want to connect to. Azure will route the address range that you specify to the on-premises VPN device IP address. There are no other operations that we can do. We don't need to set UDR, especially we don't associate a route table to the Gateway Subnet. Also, avoid associating a network security group (NSG) to the Gateway Subnet. You can check the route table by selecting Effective routes for a network interface in Azure VM. Read more details here.
If you would like to verify the connection from Azure VNet to an on-premise network, ensure that you PING a real private IP address from your on-premise network(I mean the IP address is assigned to an on-premise machine), you can check the IP address with ipconfig/all in local CMD. Moreover, you could Enable ICMP through the Windows firewall inside the Azure VM with the PowerShell command New-NetFirewallRule –DisplayName "Allow ICMPv4-In" –Protocol ICMPv4. Or, instead of using PING, you can use the PowerShell command Test-NetConnection to test a connection to a remote host.
If the problem persists, you could try to reset the Azure VPN gateway and reset the tunnel from the on-premises VPN device. To go further, you could follow these steps to identify the cause of the problem.

Having on-prem IP to point to Azure VM

I have a case where I want to migrate on-prem servers to Azure, but I should still have the local IPs pointing to these VMs. I mean by the local IPs the country-range of IPs since these VMs should be accessed using country IPs for regulatory reasons.
I heard that this is possible, but I have no idea what type of resources I should use to allow this, VNET, VPN, ExpressRoute ?? And how to do it as I have no experience in networking what so ever.
Regards,
NAT is a method of remapping one IP address space into another by modifying network address information in Internet Protocol (IP) datagram packet headers while they are in transit across a traffic routing device.
You can setup a site-to-site VPN between on-prem and Azure Vnet, then deploy a server on-prem run as the NAT device.
It is possible, but with some complications and constraints:
You can run these servers/VMs in Azure using their public IP addresses. You need to create the Virtual Network using these address ranges, but it is possible. The catch here is that these public IP addresses are only accessible via cross premises connectivity solutions such as Azure VPN gateway or Azure ExpressRoute. You cannon access these VMs using their "public" IP addresses directly over the Internet. For this purpose, these public IP address ranges are really treated as "private addresses".
Once you create the virtual network with the public IP addresses (as private address space) in Azure, you will also need to make sure your routing in the on premises network is configured correctly to forward the traffic to these VMs over the VPN tunnels or MPLS/WAN network if you are using ExpressRoute.
If these servers/VMs need to accept requests directly from the Internet, the traffic from the Internet will still come to your on premises network because that's where your ISPs will direct the traffic. You will need to ensure these traffic will be routed correctly over the cross premises connectivity (VPN/ExpressRoute) to Azure.
Hope this helps a bit. Please let me know if this answers your question.
Thanks,
Yushun [MSFT]

Resources