Azure VNET peering v/s NSG exception - azure

I am new to azure and trying to understand the concept behind VNet peering
I Have two VM First in East US and another in East Asia
By the design of AZURE, i should not be able to access any data between these VM as AZURE does not allow communication between two different VNET and to allow the communication, one may use VNET Peering !!, Correct ?
But when i add a firewall exception from VM 1 to VM 2 i am able to access the data OR when i create a VNET Peering the same happens, Can someone please share me the difference of both and what is the requirement of VNET Peering when the same can be achieved by adding firewall exception

By default when you configure a peering it has full access between vnet's. You can use nsg (network security group) to block specific traffic.
A peering connection means that you are going to have connection between vnet's from private ip, for example vnet-a 10.0.0.0/16 can only access vnet-b 192.168.0.0/16 if it has a peering connection, because those ip's (address space) are privates. When you say firewall exception, you probably configured your private ip in your nsg, it is correct, you must specify your private ip to have access from internet, not your public ip, it is how Azure has designed nsg rules. For a example, your VM's public ip is 201.200.200.15, and private ip is 10.0.0.4, in order to allow this VM to be accesible from internet, you must put your private ip 10.0.0.4 in your nsg rules, not your public ip.
From Azure portal, go to both VM blades and check public and private IP, without a peering connection you won't be able to connect each other using private IP, but using public IP you can without peering.

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

Azure NSG Private IP Congfiguration (WhiteList)Vnet to Vnet communication

I have situation where I want to open my Vnet(lets say Vnet1) for other Vnets (which has private IP range defined ) , I am thinking to use NSG rules and allow private IP ranges of other Vnets (lets say Vnet2 , Vnet3) to this entry point Subnet(in Vnet1) which host my API gateway .
I have two questions :
I assume it should be feasible using private IP addresses and allowing them using NSG (of Vnet 1/Subnet 1) ? I am not looking for peering/s2s vpn of Vnet as both belongs to separate teams and Vnet2/Vnet3 just wanted to access APis of Vnet1 using Api gateway.
Is there any security issues which we foresee , I assume it safe to expose since these are private IPs and can not be accesses from internet .
Please let me know opinion on feasibility and security .
Thanks
Xslguy
To help others who might find the same scenario, just extract the useful information in the comment and write my answer.
An Azure VNet is a logical isolation of Azure cloud dedication to your subscription. VNet peering allows traffic between two VNets is routed through Microsoft's private network only. If the VNETs haven't peered, vnet1 will not connect to resources in vnet2 by using private IP but using the public IP of the resources in vnet2. In this case, we need to restrict the source public IP for the inbound rules in the NSG attached to the subnet. With VNet peering, you also could restrict the access from one subnet to another subnet by using source private IP for the inbound rules in the NSG attached to the subnet.
From Security rules:
If you specify an address for an Azure resource, specify the private
IP address assigned to the resource. Network security groups are
processed after Azure translates a public IP address to a private IP
address for inbound traffic, and before Azure translates a private IP
address to a public IP address for outbound traffic.

Azure AKS vnet to another vnet communication

We have managed AKS Cluster and it has a few applications PODS. In the same subscription, we have a few servers in the different Resource Group and different VNET. We have a requirement to happen a communication between these two VNET's. I have configured vnet peering between two VNET's but we can see that the communication is not happening.
When I add a rule like "Allow port 443 from all networks" on to the NSG of Virtual machines then everything works fine.
Troubleshooting steps are done.
VNET Peering
Got an API Server IP Address from the "kubeconfig" file and added in the NSG of VM's in a diff RG.
But did not resolve an issue. Could you please help me to fix the issue.
AKS Resources are behind the Internal Load Balancer, so peering did not help. I had to use the Public IP Address provisioned during the AKS Creation process in the NSG. After adding PIP(Available in MC_rg-*** resource group) everything started working.
I would suggest to try connecting the VNET's through VPN gateways .
From an Azure virtual network, connecting to another virtual network is essentially the same as connecting to an on premises network via site-to-site (S2S) VPN.
You will need to go through the below listed steps :
Create VNetA and VNetB and the Corresponding Local Networks.
Create the Dynamic Routing VPN Gateways for each virtual network.
Connect the VPN Gateways.
Please find the referred document for implementing the same solution I have mentioned above .
For more information on difference of vnet peering and vnet gateway you can refer this document.

Private endpoint with virtual network gateway

I want to make a Postgres DB available on-premise using a VPN / Virtual Network Gateway. I've created the Virtual Network Gateway with GatewaySubnet, the Local Network Gateway and the VPN Connection.
Now I want to create a private endpoint in the GatewaySubnet but I am getting the following errors:
Portal: "The selected subnet GatewaySubnet is restricted and cannot be used with a private endpoint"
or
ARM: "Subnet with name 'GatewaySubnet' can be used only for the Gateway resource."
Am I missing something? I thought the GatewaySubnet is exactly the Subnet that will be made accessible over the VPN?
The GatewaySubnet is a special subnet that contains the IP addresses that the virtual network gateway services use. Never deploy anything else (for example, additional VMs) to the gateway subnet. You can only leave it empty without any other resources deployed to this subnet.
When you deploy a VPN gateway in one Azure virtual network. With site-to-site VPN connection, all subnets in that VPN VNet could access the on-premise network because by default resources in all subnets in the same virtual network could communicate with each other. So you can deploy another subnet in the same VPN VNet used for your private endpoint.
See the diagram for using cases of Private Link for Azure Database for PostgreSQL

getting a block of public IP subnet from microsoft

Does anyone know if its possible to have my corporate azure account to be assigned a block (e.g. subnet) of azure public IP within a region to make it easier to create firewall rules for my corporate firewall which blocks most outgoing ports.
Our customer does not want anyone sourced inside from the corporate .com account to have access to all 22 and 3389 ports out on the internet, but will limit them to a subnet if we can be assigned a subnet on which we will hang our bastion servers on.
I wouldn't know about blocks of IP's, but you can certainly create a virtual network in which you create all your resources in Azure, and hten configure a firewall in azure, which will have a permanent IP. This can then be used to set up a site-to-site VPN thing between your corporate network and the machines in Azure.
https://azure.microsoft.com/en-gb/services/virtual-network/
For public facing ports, you can add another virtual network card and rest assured that the traffic on one card cannot, in any way pass over to the other, network connected card.
This would also be a better strategy than to set up a range of VM's in Azure with public IP's.

Resources