Questions tagged [azure-nsg]

Network Security Groups (NSG) filters network traffic to and from Azure resources in an Azure virtual network. A Network Security Group(NSG) contains security rules that allow or deny inbound network traffic to, or outbound network traffic from, several types of Azure resources. For each rule, there are source and destination, port, and protocol.

A Network Security Groups (NSG) controls the network traffic to and from Azure resources in an Azure virtual network. A Network Security Group(NSG) contains security rules that allow or deny inbound network traffic to, or outbound network traffic from, several types of Azure resources.

Network security group security rules are evaluated by priority using the 5-tuple information (source, source port, destination, destination port, and protocol) to allow or deny the traffic. Each rule is specified with following propertie

  • Priority: A number between 100 and 4096. Rules are processed in priority order, with lower numbers processed before higher numbers, because lower numbers have higher priority. Once traffic matches a rule, processing stops. As a result, any rules that exist with lower priorities (higher numbers) that have the same attributes as rules with higher priorities are not processed.
  • Source or destination: Any, or an individual IP address, classless inter-domain routing (CIDR) block (10.0.0.0/24, for example).
  • Protocol: TCP, UDP, or Any, which includes TCP, UDP, and ICMP. You cannot specify ICMP alone, so if you require ICMP, use Any.
  • Direction: Whether the rule applies to inbound, or outbound traffic.
  • Port/Port Range: You can specify an individual or range of ports. For example, you could specify 80 or 10000-10005. Specifying ranges enables you to create fewer security rules.
  • Action: Allow or deny

By default for any port, NSG allows all traffic from Virtual network to Virtual Network, allows all traffic from AzureLoadBalancer to any host and denies all traffic from any other source to any host.

115 questions
0
votes
1 answer

NSG Rule Automation Powershell

I'm trying to automate my NSG rules and find out wrong nsg rules. here I'm trying to find the source Ip address is added or not but the code getting executed and deleting the rules even if the IP addresses are available. $nsg =…
0
votes
1 answer

Open Tomcat to external network

I have a CentOS 7 VM on Azure and having serious troubles to make it reachable from Internet. Meanwhile it looks to be perfectly reachable by internal network: [root@localhost bin]# telnet 192.168.200.128 8080 Trying 192.168.200.128... Connected to…
0
votes
0 answers

Update NSG Rule - Unable to add ASG (source\destination)

I’m trying to update rule source that contain ASG with additional ASG, by using the following: networkSecurityGroup .update() .updateRule(ruletest) …
0
votes
1 answer

ApplicationGatewaySubnetInboundTrafficBlockedByNetworkSecurityGroup error when destroying resources with terraform

I am creating Azure infra using terraform. I am able to create AppGateway in gateway subnet. The AppGateway required NSG rule to all access on ports 65200 - 65535, I have added the NSG. I am able to communicate with app behind AppGateway. But my…
Sunil
  • 429
  • 1
  • 9
  • 25
0
votes
0 answers

dynamic block is able to add nsg rules properly but unable to remove all the rules when i define the nsg rules to be empty list []

My code is as follow, nsg.tf: locals { nsg_names = ["pri_nsg_1_subnet","pri_nsg_2_subnet"] } resource "azurerm_network_security_group" "nsg_creation" { count = length(local.nsg_names) name = local.nsg_names[count.index] …
0
votes
1 answer

Can't connect to Azure Kubernetes cluster from internet

I have an ingress-nginx ingress for my Kubernetes service. If I curl the external IP from inside the cluster, like from a pod such as this kubectl run my-shell --rm -i --tty --image ubuntu -- bash, I get the result I expect. If I curl from the…
0
votes
1 answer

Cannot ping PostgreSQL in private subnet from a VM in public subnet

I have a private subnet in VNet 1 with Network Security Group only allowing inbound traffic from a specific private IP CIDR. This subnet hosts Azure Database for PostgreSQL with a server name. I also have a public subnet in a different VNet (VNet2)…
HelmBurger
  • 1,168
  • 5
  • 15
  • 35
0
votes
0 answers

Terraform List Objects in For Each Loop

I am trying to setup three NSGs with the same rules, so to tackle this I have made a for each loop. Yet on one of the rules I need to pass two ip addresses, and I keep getting errors that basically the foreach loop wont accept two values passed…
Jason
  • 510
  • 5
  • 27
0
votes
1 answer

Azure Kubernetes Load Balancer not working

Deploy NGINX demo containers and setup loadbalancer on Azure, the page cannot be loaded. I think it is some problem on NSG, can someone please tell me whats wrong. kubectl run hello-app --image=nginxdemos/hello --port=80 kubectl expose pod hello-app…
scout249
  • 3
  • 3
0
votes
1 answer

How to prevent IP spoofing for Azure VMs?

I have an Azure web app which talks to the Azure VMs via Azure Load balancer. The VMs have NSG rules setup. The VMs are also being used by other servers/web apps. How do I prevent someone impersonating the IP and trying to get access to the VMs? Or…
0
votes
2 answers

Get Azure resources associated with a subnet through Azure Resource Graph Query

I am looking to fetch all resources associated with a subnet. I could find references oh how to do it the other way around (fetch a particular resource and it includes the subnet it is associated with), but can't find any documents where we can…
Godson
  • 1
  • 1
  • 2
0
votes
1 answer

Create NSG ARM Template from CSV via Azure PowerShell

I am trying to automate my NSG creation, as well as NSG remediation for Azure via DevOps pipelines. Therefore, I wrote a PowerShell script that creates an ARM Template, which is deployable in Azure, from a CSV with the specified NSG ruleset. The…
0
votes
1 answer

Azure automation script check if SSH of VM is open

I need to develop a script on azure automation (Powershell)that runs all VMs in subscription and checks every 1 hour if a VM has the SSH port open, if that port is open than i close it automatically . Thank you for helping me with information and…
0
votes
1 answer

Azure - Virtual Network Gateway Limited IP Addresses - Solution Needed

Hoping someone here can help me find a solution to an issue we are having with a Virtual Network Gateway in Azure. I come from the development side so hoping there are some network gurus out there... We have a VNG that has a dedicated site to site…
0
votes
1 answer

private vnet: Git clone my azure repo from Azure ML compute instance is impossible

Since a few days, I try to clone my Azure Devops repo in my Azure ML compute instance but I can't do it. In fact, I am in my private network with a private compute instance. So obviously I have to create rules in my network security group to allow…