nsg

Network Security Group

NetworkingAzure
General

General information about the service.

Description

Filter network traffic to and from Azure resources.

Namespace and Entity

Microsoft.Network/networkSecurityGroups

Chat

Powered by AI

Talk to this service to learn more about it.

Suggested questions:

Naming

The conventions, rules, and restrictions for naming this service.

Naming Convention

nsg-

Length

1-80

Valid Characters

Alphanumerics, hyphens, underscores.

Scope

resource group

Code

Deploy your infrastructure as code using your preferred tooling.

Official DocumentationTerraform
terraform
1resource "azurerm_network_security_group" "main" {
2 name = "nsg-${var.workload}-${var.environment}"
3 location = azurerm_resource_group.main.location
4 resource_group_name = azurerm_resource_group.main.name
5
6 security_rule {
7 name = "AllowHTTPS"
8 priority = 100
9 direction = "Inbound"
10 access = "Allow"
11 protocol = "Tcp"
12 source_port_range = "*"
13 destination_port_range = "443"
14 source_address_prefix = "*"
15 destination_address_prefix = "*"
16 }
17
18 security_rule {
19 name = "DenyAllInbound"
20 priority = 4096
21 direction = "Inbound"
22 access = "Deny"
23 protocol = "*"
24 source_port_range = "*"
25 destination_port_range = "*"
26 source_address_prefix = "*"
27 destination_address_prefix = "*"
28 }
29
30 tags = var.tags
31}
Utilities

Utilities to support app deployment or configuration.