DenyVnetInbound in Azure NSG - azure

For Azure Network Security Groups (NSGs), we have a default inbound security rule called AllowVnetInBound rule.
AllowVnetInboundRule - https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview#allowvnetinbound
But is there a way to create a rule that denies vnet to vnet inbound rule? I am trying to achieve this both from portal and azure powershell, but I don't see any vnet option in the dropdown for the source.

if I understood correctly, you could use the Service Tag called 'VirtualNetwork' in your Inbound Security Rules, and it should be enough to Deny inbound traffic coming from the same Virtual Network.

Related

How to block traffic between VMs in the same subnet in Azure other than NSG

I know NSG can easily do that, but for some reason I can not use NSG, is there any other alternative can do the same? Firewall within VM might also work, but it's better to control that in Azure level, so I don't have to login to the VM so config that.
You can use Application Security Group (ASG). ASGs are used within a NSG to apply a network security rule to a specific VM or a group of VMs.
You can start here https://learn.microsoft.com/en-us/azure/virtual-network/application-security-groups

Azure ASE v2 - restrict network access for app services

I have an ILB ASE v2 with WAF (public IP). The ASE has its subnet where all web apps reside. For obvious security reasons I think I need to lock down access from Internet and leave only HTTPS open. But when I do that I can't see app services info in the portal. So what should my NSG look like for this subnet?
Also, WAF has its own subnet. It doesn't have NSG assigned either. Should it have one?
When you add a NSG to the AppSercice subnet with Deny All internet traffic, it is blocking the portal to fetch information from App Device. Try adding a NSG rule with greater priority with source IP as Azure Cloud tag and allow it.
So you are blocking all Internet traffic and allowing Azure IPs for communication.
Let me know if it works.
Here's the resulting rules set for ASE subnet NSG:
you might want to add HTTP to it if you need it.

Do I need to open Azure NSG firewall rule and VM firewall rule at the same time

VM1 needs to talk to VM2 on port 4567 (In Azure). Both VMS are on the same subnet. Can I just create an inbound rule on the NSG attached to both Vms that says open port 4567? Will this work?
Or do I also need to log onto both VM's and configure the firewall rules?
What is the proper way to configure this? in terms of best practice.
Yes, you have to, because NSG doesnt talk to your VM to alter settings on it. NSG is an Azure level firewall.
There are subnet or network interface level NSG in Azure with ARM model. Usually we just use the subnet level NSG that will take effect on all the VMs in the same subnet. If the VMs in the same subnet, by default, the traffic from VMs can pass though the NSG each other as there is an AllowVnetInBound rule.
Windows firewall is another firewall inside the VMs. You can configure it or not configure it. Suggest to configure it for more security. If you want to open port 4567 from VM1 talk to VM2, you only need to open it in VM firewall rule if you have configured it.
Ref: Azure Network Security Groups (NSG) – Best Practices and Lessons Learned

Azure NSG rules for traffic from an Azure Cloud Service

I have an Azure cloud service and a Azure Kubernetes Service(AKS). AKS is within a NSG. I would like to create rules in network security group(NSG) to restrict inbound traffic from only the specific cloud service.
Since cloud service IP could change, I would not be able to base the NSG rules on IP. Also, I do not see cloud service in the azure service tags list in NSG.
How do I achieve this NSG rules configuration ?
It seems that you want to restrict inbound traffic from only the specific cloud service to AKS. Conversely, you can add inbound rules to allow the traffic that you want to access to AKS, Then the traffic you have not added the allowing rule will be denied since there is a DenyAllInBound inbound rule in each NSG. The traffic filters according to the priority. (High priority is small value) in the inbound rule.
Update
If you only allow one specific cloud service in the inbound traffic, you just set the source to the specific IP address in the inbound rule of yours NSG. The assigned IP address for the cloud service doesn't change unless you stop and restart provision of the service. If you ensure to know the fixed IP address in your subscription even if you deprovision and reprovision, you can use a Reserved IP address for Cloud Services. Ref: Static IP for Cloud Service on Azure
Reserved IP addresses (Classic)

How do I restrict traffic from webapp to a subnet in VNet

I have 3 subnets in my VNet and I would like to restrict traffic coming from a VNET integration on a webapp to just one of the three subnets. Is it possible to do that?
Inbound and outbound network traffic on a subnet can be network security group controlled using a network security group. Controlling inbound traffic requires creating network security rules in a network security group, and then assigning the network security group the subnet containing the App Service Environment
It totally possible by using NSG, please follow the recommendations from the service ASE
https://learn.microsoft.com/en-us/azure/app-service/environment/app-service-app-service-environment-control-inbound-traffic#creating-a-network-security-group

Resources