Microsoft.Network networkSecurityGroups/securityRules

Bicep resource definition

The networkSecurityGroups/securityRules resource type can be deployed to:

For a list of changed properties in each API version, see change log.

Remarks

For guidance on creating network security groups, see Create virtual network resources by using Bicep.

Resource format

To create a Microsoft.Network/networkSecurityGroups/securityRules resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.Network/networkSecurityGroups/securityRules@2022-05-01' = {
  name: 'string'
  parent: resourceSymbolicName
  properties: {
    access: 'string'
    description: 'string'
    destinationAddressPrefix: 'string'
    destinationAddressPrefixes: [
      'string'
    ]
    destinationApplicationSecurityGroups: [
      {
        id: 'string'
        location: 'string'
        properties: {}
        tags: {}
      }
    ]
    destinationPortRange: 'string'
    destinationPortRanges: [
      'string'
    ]
    direction: 'string'
    priority: int
    protocol: 'string'
    sourceAddressPrefix: 'string'
    sourceAddressPrefixes: [
      'string'
    ]
    sourceApplicationSecurityGroups: [
      {
        id: 'string'
        location: 'string'
        properties: {}
        tags: {}
      }
    ]
    sourcePortRange: 'string'
    sourcePortRanges: [
      'string'
    ]
  }
}

Property values

networkSecurityGroups/securityRules

Name Description Value
name The resource name

See how to set names and types for child resources in Bicep.
string (required)

Character limit: 1-80

Valid characters:
Alphanumerics, underscores, periods, and hyphens.

Start with alphanumeric. End alphanumeric or underscore.
parent In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource.

For more information, see Child resource outside parent resource.
Symbolic name for resource of type: networkSecurityGroups
properties Properties of the security rule. SecurityRulePropertiesFormat

SecurityRulePropertiesFormat

Name Description Value
access The network traffic is allowed or denied. 'Allow'
'Deny' (required)
description A description for this rule. Restricted to 140 chars. string
destinationAddressPrefix The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. string
destinationAddressPrefixes The destination address prefixes. CIDR or destination IP ranges. string[]
destinationApplicationSecurityGroups The application security group specified as destination. ApplicationSecurityGroup[]
destinationPortRange The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. string
destinationPortRanges The destination port ranges. string[]
direction The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. 'Inbound'
'Outbound' (required)
priority The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. int
protocol Network protocol this rule applies to. '*'
'Ah'
'Esp'
'Icmp'
'Tcp'
'Udp' (required)
sourceAddressPrefix The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. string
sourceAddressPrefixes The CIDR or source IP ranges. string[]
sourceApplicationSecurityGroups The application security group specified as source. ApplicationSecurityGroup[]
sourcePortRange The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. string
sourcePortRanges The source port ranges. string[]

ApplicationSecurityGroup

Name Description Value
id Resource ID. string
location Resource location. string
properties Properties of the application security group. ApplicationSecurityGroupPropertiesFormat
tags Resource tags. object

ApplicationSecurityGroupPropertiesFormat

This object doesn't contain any properties to set during deployment. All properties are ReadOnly.

ARM template resource definition

The networkSecurityGroups/securityRules resource type can be deployed to:

For a list of changed properties in each API version, see change log.

Remarks

For guidance on creating network security groups, see Create virtual network resources by using Bicep.

Resource format

To create a Microsoft.Network/networkSecurityGroups/securityRules resource, add the following JSON to your template.

{
  "type": "Microsoft.Network/networkSecurityGroups/securityRules",
  "apiVersion": "2022-05-01",
  "name": "string",
  "properties": {
    "access": "string",
    "description": "string",
    "destinationAddressPrefix": "string",
    "destinationAddressPrefixes": [ "string" ],
    "destinationApplicationSecurityGroups": [
      {
        "id": "string",
        "location": "string",
        "properties": {},
        "tags": {}
      }
    ],
    "destinationPortRange": "string",
    "destinationPortRanges": [ "string" ],
    "direction": "string",
    "priority": "int",
    "protocol": "string",
    "sourceAddressPrefix": "string",
    "sourceAddressPrefixes": [ "string" ],
    "sourceApplicationSecurityGroups": [
      {
        "id": "string",
        "location": "string",
        "properties": {},
        "tags": {}
      }
    ],
    "sourcePortRange": "string",
    "sourcePortRanges": [ "string" ]
  }
}

Property values

networkSecurityGroups/securityRules

Name Description Value
type The resource type 'Microsoft.Network/networkSecurityGroups/securityRules'
apiVersion The resource api version '2022-05-01'
name The resource name

See how to set names and types for child resources in JSON ARM templates.
string (required)

Character limit: 1-80

Valid characters:
Alphanumerics, underscores, periods, and hyphens.

Start with alphanumeric. End alphanumeric or underscore.
properties Properties of the security rule. SecurityRulePropertiesFormat

SecurityRulePropertiesFormat

Name Description Value
access The network traffic is allowed or denied. 'Allow'
'Deny' (required)
description A description for this rule. Restricted to 140 chars. string
destinationAddressPrefix The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. string
destinationAddressPrefixes The destination address prefixes. CIDR or destination IP ranges. string[]
destinationApplicationSecurityGroups The application security group specified as destination. ApplicationSecurityGroup[]
destinationPortRange The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. string
destinationPortRanges The destination port ranges. string[]
direction The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. 'Inbound'
'Outbound' (required)
priority The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. int
protocol Network protocol this rule applies to. '*'
'Ah'
'Esp'
'Icmp'
'Tcp'
'Udp' (required)
sourceAddressPrefix The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. string
sourceAddressPrefixes The CIDR or source IP ranges. string[]
sourceApplicationSecurityGroups The application security group specified as source. ApplicationSecurityGroup[]
sourcePortRange The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. string
sourcePortRanges The source port ranges. string[]

ApplicationSecurityGroup

Name Description Value
id Resource ID. string
location Resource location. string
properties Properties of the application security group. ApplicationSecurityGroupPropertiesFormat
tags Resource tags. object

ApplicationSecurityGroupPropertiesFormat

This object doesn't contain any properties to set during deployment. All properties are ReadOnly.

Terraform (AzAPI provider) resource definition

The networkSecurityGroups/securityRules resource type can be deployed to:

  • Resource groups

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.Network/networkSecurityGroups/securityRules resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Network/networkSecurityGroups/securityRules@2022-05-01"
  name = "string"
  parent_id = "string"
  body = jsonencode({
    properties = {
      access = "string"
      description = "string"
      destinationAddressPrefix = "string"
      destinationAddressPrefixes = [
        "string"
      ]
      destinationApplicationSecurityGroups = [
        {
          id = "string"
          location = "string"
          properties = {}
          tags = {}
        }
      ]
      destinationPortRange = "string"
      destinationPortRanges = [
        "string"
      ]
      direction = "string"
      priority = int
      protocol = "string"
      sourceAddressPrefix = "string"
      sourceAddressPrefixes = [
        "string"
      ]
      sourceApplicationSecurityGroups = [
        {
          id = "string"
          location = "string"
          properties = {}
          tags = {}
        }
      ]
      sourcePortRange = "string"
      sourcePortRanges = [
        "string"
      ]
    }
  })
}

Property values

networkSecurityGroups/securityRules

Name Description Value
type The resource type "Microsoft.Network/networkSecurityGroups/securityRules@2022-05-01"
name The resource name string (required)

Character limit: 1-80

Valid characters:
Alphanumerics, underscores, periods, and hyphens.

Start with alphanumeric. End alphanumeric or underscore.
parent_id The ID of the resource that is the parent for this resource. ID for resource of type: networkSecurityGroups
properties Properties of the security rule. SecurityRulePropertiesFormat

SecurityRulePropertiesFormat

Name Description Value
access The network traffic is allowed or denied. "Allow"
"Deny" (required)
description A description for this rule. Restricted to 140 chars. string
destinationAddressPrefix The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. string
destinationAddressPrefixes The destination address prefixes. CIDR or destination IP ranges. string[]
destinationApplicationSecurityGroups The application security group specified as destination. ApplicationSecurityGroup[]
destinationPortRange The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. string
destinationPortRanges The destination port ranges. string[]
direction The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. "Inbound"
"Outbound" (required)
priority The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. int
protocol Network protocol this rule applies to. "*"
"Ah"
"Esp"
"Icmp"
"Tcp"
"Udp" (required)
sourceAddressPrefix The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. string
sourceAddressPrefixes The CIDR or source IP ranges. string[]
sourceApplicationSecurityGroups The application security group specified as source. ApplicationSecurityGroup[]
sourcePortRange The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. string
sourcePortRanges The source port ranges. string[]

ApplicationSecurityGroup

Name Description Value
id Resource ID. string
location Resource location. string
properties Properties of the application security group. ApplicationSecurityGroupPropertiesFormat
tags Resource tags. object

ApplicationSecurityGroupPropertiesFormat

This object doesn't contain any properties to set during deployment. All properties are ReadOnly.