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
1
vote
1 answer

Azure NSG - Filter certain IPs from input csv

I am using PowerShell to create Azure NSGs which will use input from a .csv file with security rules. I am using the script below. $NSG = Get-AzureRmNetworkSecurityGroup -Name test -ResourceGroupName RG-VM-QTY foreach($rule in import-csv…
0
votes
1 answer

How to access Azure ubantu http 80 port?

I use "flask run -p 80" to start a python web api in Azure ubantu 22. I use curl to test it successfully in VM I open firewall for 80 I also add security rule for azure NSG, it test successfully. But I can not access the flask 80 portal use…
Harly Chen
  • 33
  • 4
0
votes
1 answer

Azure Terraform Network Security Group Association to a Subnet with Modules

I need to create a module based application with Terraform in Azure. https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet_network_security_group_association Basically I need the above but using modules for both the…
soldier
  • 1
  • 2
0
votes
1 answer

azure web app vnet integration and network security group(app service 403 forbidden)

I have created a vnet and integrate Nsg with it and in Nsg I have allow the my app service all outbound ip's and my local system public ip's. In My App service I have add the above created Vnet and in app service access restriction I added the vnet…
0
votes
1 answer

How to configure NSG for WAF v2 Application Gateway subnet?

I want to configure Network Security Group(NSG) for my Application gateway(AG) subnet. I tried to follow this doc - here but after applying the inbound rules to my NSG, I am getting timeout when hitting the webapp url(which is in the backend pool of…
0
votes
1 answer

Trying to query Azure Resource Graph Explorer for NSGs with missing rules

The following query fails with 2 ParserFailure errors, both on line 5. At least that's where the query builder shows the red curly line. The intention of this query is probably obvious to the Azure KQL initiates, but I'll explain nonetheless just to…
Bobtb
  • 26
  • 3
0
votes
1 answer

Azure/Terraform:Link subnets to NSGs(ERROR-for_each map includes keys derived from resource attributes that cannot be determined until apply)

Objective:Link multiple subnets in the environment to corresponding NSGs using a module (NSGs and Subnets have been created using separate modules) Root Module: 1.main.tf resource "azurerm_subnet_network_security_group_association"…
0
votes
1 answer

Automate NSG rule creation for NSGs within azure: Type error from Get-AzNetworkSecurityGroup

I am trying to write a script to automate creating NSG rules for our production NSGs. I am pretty sure I have something close to working but the issue I run into is that the Get-AZNetworkSecurityGroup command returns a string and so I cant feed it…
0
votes
1 answer

Default NSG for all Azure Subscriptions via Terraform

I am trying to implement a strategy where I can create a NSG in one Azure subscription and use the same NSG resource to attach to any VMs or NICs created in other subscriptions and resource groups. How can this implementation work via Terraform…
0
votes
1 answer

Azure Function cannot access SQL database hosted on Azure VM

I have an Azure Function with a Consumption plan and an Azure VM with a Network Security Group attached. I want the Azure Function to call the database, but the connection to SQL cannot be established. I've tried to allow access to Azure Function to…
Sergiu Molnar
  • 865
  • 1
  • 11
  • 22
0
votes
1 answer

Azure Network Security Group - Multiple source IP addresses

I have a NSG for controlling inbound traffic to my VM. One of the rules controls inbound TCP traffic on port 5061. We only want traffic to come from a specific group of external IP addresses, otherwise the traffic will be dropped. Is there a way to…
Brian Fleishman
  • 1,237
  • 3
  • 21
  • 43
0
votes
1 answer

Azure NSG rule to allow VM to access MS 365 Defender

I have a VNET which restricts all access outbound using an NSG except for 1 specific port which is used for an app it hosts. However I need a way to allow Defender to communicate with the MS 365 Defender portal so it can report in. I tried using a…
amaru96
  • 171
  • 2
  • 17
0
votes
1 answer

Azure Policy to deny creation of Network Interfaces without NSG attached

Hey I am looking to assign Azure Policy which will deny creation of Network Interfaces without NSG attached. I looked with build-in role and couldn't find anything related. Maybe someone have script that does the job. Thanks for your help in…
0
votes
2 answers

External VNET name resolution dc.services.visualstudio.com

Error code in APIM in external vnet mode: Connection to https://dc.services.visualstudio.com/v2/track failed with WebException: NameResolutionFailure: The remote name could not be resolved: 'dc.services.visualstudio.com' NSG in place that blocks…
Erik Oppedijk
  • 3,496
  • 4
  • 31
  • 42
0
votes
0 answers

Azure Network Security Group - Internet vs Any

In the Image we can see AllowInternetOutboundRule is open to Internet. But does Internet here convey 0.0.0.0/0 IP? If not, then what is difference between 'Internet' and 'Any'. Also, does AllowInternetOutboundRule imply port 443 open to 0.0.0.0/0…