Azure VM - Creating TCP inbound rules - security

Please, I am trying to do some that should be simple... but it is not working.
I have 03 VMs in the same subnet.
The Subnet has a security group that I created HTTP/80 inbound OK.
Now, I need to open SQL to my second VM in the same subnet.
I already try to change the security group of my VM running SQL to the same of the IIS server.
I did do my Windows firewall inbound rule too. No way.
I tried to created another rule to test if my security group was forwarding correctly, without success.
This is my SQLIN rule:
Priority: 2100 / Source: Any / Protocol: TCP / Source port: 1433 / Target: CIDR Block: x.x.x.x/32 (server vm azure ip (internal) / Target port: 1433 / Action: ALLOW.
I can access my SQL through my VPN, but I need to open to the Internet.
The another test to check if my security group is doing what I create in the rules... is... I try to open RDP through port 3390... and redirect to 3389 (because in this security group I already have 3389 published to another server...)
The rule
Priority: 2120 / Source: Any / Protocol: TCP / Source port: 3390 / Target: CIDR block: x.x.x.x/32 (server vm azure ip interrna) / Target port: 3389 / Action: ALLOW.
I did not have sucess in both rules.
Again: Subnet is associated to this security group, and BOTH VMs are associated to this sec group.

If the 2 VMs are on the same subnet then you don't need to open up the NSG for the machines to talk to each other - you should just be able to use the windows firewall rules. Make the SQL VM private by making sure it doesn't have a public IP, or use the NSG here. I suspect the problem is with windows firewall from the IIS box or into the SQL box.

Related

Can't access Azure VM HTTP Web Site from Outside of Azure

I've setup a VM and installed IIS. I checked that the firewall rules were enabled for HTTP and HTTPS. Furthermore, in Azure Portal, I've enabled the two predefined inbound security network group rules for HTTP and HTTPS.
When in the VM, I can go to localhost and see the default Web page of IIS Default Web Site.
Inbound security rule in Network Security Group
Anybody know how to go about figuring out how to make this work?
Thx
You should add port 443 and port 80 to azure VM windows firewall inbound rules.
Are the Source port ranges on your inbound rules set to 80/443 or * (i.e. all source ports)?
Try changing them to * with only the destination ports set to 80 or 443 respectively.
Ex:
Refer How to open ports to a virtual machine with the Azure portal for more details.
There are two ways to make your site accessible from the Internet.
Use the public IP address which is associated to the virtual machine's NIC.
Configure DNS for your VM machine (e.g. web.southeastasia.cloudapp.azure.com). This DNS is bounded to the associated public IP Address.
Reference: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/portal-create-fqdn
In your IIS, just configure binding to make sure the incoming request from the Internet is recognized by IIS.
You also need to make sure you have no rule in Network Security Group (NSG) blocking port 80. Or if there is a NSG, you need to create an inbound rule to allow port 80.
I Azure Windows VM, apart from configuring the NSG rule, we should also create a Windows firewall rule to allow inbound TCP connections on the required port. Just RDP into your windows VM, open Windows Defender Firewall and add the rule

Cannot isolate Azure subnets in same virtual network

I may be way off base here because I am not a networking expert, and new to Azure. I am having problems isolating two subnets in an Azure virtual network.
Scenario:
One virtual network (vn) with address space 10.0.0.0/16.
Two subnets (subnet1 and subnet2)
subnet1: 10.0.0.0/24
subnet2: 10.0.1.0/24
Two virtual machines (vm1 and vm2). Each virtual machine is Windows Server 2012 R2 with Windows Firewall disabled.
vm1 lives in subnet1,
vm2 lives in subnet2
vm2 has web service bound to port 5550. vm1 has client (browser) hitting web service on vm2. I can successfully access the web server action on vm2 via client (browser) on vm1.
Two network security groups (nsg1 and nsg2).
nsg1 is associated with subnet1,
nsg2 is associated with subnet2
The default inbound rules, particularly for nsg2, allows access from vnet via default rule:
PRIORITY: 65000,
NAME: AllowVnetInbound,
SOURCE: VirtualNetwork,
DESTINATION: VirtualNetwork,
SERVICE: Custom(Any/Any),
ACTION: Allow
I am trying to configure nsg2 to DENY traffic from vm1 to vm2 i.e. subnet1 to subnet2. I can't seem to make this work; not matter what deny rule I put in place the client on vm1 is always able to access the web server on vm2.
I added a new rule with higher priority:
PRIORITY: 200,
NAME: DenyVnetInbound,
SOURCE: VirtualNetwork,
DESTINATION: VirtualNetwork,
SERVICE: Custom(Any/Any),
ACTION: Deny
Does not work, client on vm1 is still able to access web server on vm2.
Also tried variations..
PRIORITY: 200,
NAME: DenyVnetInbound,
SOURCE: 10.0.0.0/24,
DESTINATION: 10.0.1.0/24,
SERVICE: Custom(Any/Any),
ACTION: Deny
This doesn't work either. Is it possible to isolate subnets in the same virtual network in Azure?
I can now block other subnets in a repeatable fashion. I am using rule:
PRIORITY: 4000
NAME: DenyVNet
SOURCE: VirtualNetwork
DESTINATION: All
SERVICE: Custom (Any/Any)
ACTION: Deny
I believe the root cause is that I had a faulty test(s). I suspect the issue has to do with HTTP persistent connections from the browser (and other test applications using HTTP). HTTP Keep-Alive?
When I change the NSG rules (inbound on target subnet):
ACTION RESULT
Kill both client and service New rule always works
Kill either client or service New rule works...most of time
Don't kill either client or service New rule never works, old rule behaviour remains
This pattern seems repeatable for Azure NSGs. I also believe this to be the case for AWS VPC security groups / network ACLs.

remote desktop to an azure VM (created by the new portal - portal.azure.com) over the port 443

I have a Virtual Machine created in the new azure portal (portal.azure.com)
Now I can connect to by using the Remote Desktop by the port 3389, without any problems.
I am asking for a guide to setting my virtual machine can be remoted over the port 443 also (since the working network just allows outcoming 443 only)
With the classic portal, I just need to add an "end point" and that works.
However with the new portal, in the "network security group", I tried to modify the "inbound security rules", changed the default value 3389 to 443, but I got no luck.
Edited: captured screenshots
New VM created as "Azure Resource Manager" (ARM) have different options and features but they lost end-points. Endpoints, in classic deployment, allowed to remap internal ports to external ports, changing the value.
Now, in ARM, to have a similar behaviour, you have to use LoadBalancer. Read at the end of https://blogs.msdn.microsoft.com/mast/2016/02/04/azure-networking-public-ip-addresses-in-classic-vs-arm/ for an example to map external 50000 to internal 80.
As I understand them, Network Security Groups don't actually do any port mapping, just allow/deny access to certain ports. If you want the RDP server to still listen on 3389 and for external RDP requests to go to 443, you'll need to use Azure Load Balancer with NAT rules (https://azure.microsoft.com/en-us/documentation/articles/load-balancer-get-started-internet-arm-ps/#create-lb-rules-nat-rules-a-probe-and-a-load-balancer). Alternatively, you could configure your RDP server to listen on port 443. It's up to you which you prefer :).

Not able to access application hosted on Linux VM on Azure cloud

I have created a CentOS 7.1 VM using Resource Manager deployment model.
I am not able to access the application using a browser on a machine connected to internet.
However I am able to access the application on same machine and other VM on same virtual network using private IP address.
I configured Network Security Group and allowed port 80 and 443 in Inbound Rules.
Well, it turned out that I needed to open ports under "Inbound Security Rules" and needed to open all in "Source Port Range". For doing so, i needed to put * there and in Destination port for https - 443 etc.
This * thing was the catch which i was missing in all the Inbound security rules for allowing the ports.

Connection timeout port 80 on new Azure VM with NSG rules configured

I just created a new Ubuntu 14.04 virtual machine in Microsoft Azure using the (recommended) resource manager deployment model. The following screenshots show the deployment configuration and the resulting resources:
Once it was deployed, I accessed the VM using SSH through the public IP, logged in and installed nginx. I left it with the default configuration and did a 'curl localhost' to ensure the webserver was running.
Then I went to the Network Security Group resource and added an Allow rule for port 80 to the Inbound rules:
I then opened a browser and tried to request the public IP associated with the NIC and got a connection timeout.
Edit: I can get access by disassociating the NSG from the NIC, but if I re-associate it, I will get blocked again within a few minutes.
I have tried using the same process to set up a Windows Server VM, with IIS, but I'm getting the same result.
What am I missing here?
I get no errors when doing the same setup using the classic deployment model, this only occurs when trying the recommended resource manager model.
For the ones that still struggle with the inbound rules on the new Portal Azure, you need to set up the Network Security Group (NSG) to:
allow connections from (source):
any sources
and
* - for the source port range (extremely important as it may seem normal to set 80 or 443 - which is not correct)
destination:
any
and
80 - as the destination port range (or the port that your webserver is listening to - it could be also 8080 or other)
The same goes for other ports like the 443 for the https connections.
What is your source port on your NSG? Did you leave it Any/*? If not you are limiting yourself to traffic coming only from that one port.

Resources