NetworkSecurityGroup

Manages a network security group that contains a list of network security rules. Network security groups enable inbound or outbound traffic to be enabled or denied.

NOTE on Network Security Groups and Network Security Rules: This provider currently provides both a standalone Network Security Rule resource, and allows for Network Security Rules to be defined in-line within the Network Security Group resource. At this time you cannot use a Network Security Group with in-line Network Security Rules in conjunction with any Network Security Rule resources. Doing so will cause a conflict of rule settings and will overwrite rules.

Create a NetworkSecurityGroup Resource

def NetworkSecurityGroup(resource_name, opts=None, location=None, name=None, resource_group_name=None, security_rules=None, tags=None, __props__=None);
name string
The unique name of the resource.
args NetworkSecurityGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args NetworkSecurityGroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args NetworkSecurityGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

NetworkSecurityGroup Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The NetworkSecurityGroup resource accepts the following input properties:

ResourceGroupName string

The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.

Location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

The name of the security rule.

SecurityRules List<NetworkSecurityGroupSecurityRuleArgs>

A list of objects representing security rules, as defined below.

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

ResourceGroupName string

The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.

Location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

The name of the security rule.

SecurityRules []NetworkSecurityGroupSecurityRule

A list of objects representing security rules, as defined below.

Tags map[string]string

A mapping of tags to assign to the resource.

resourceGroupName string

The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.

location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name string

The name of the security rule.

securityRules NetworkSecurityGroupSecurityRule[]

A list of objects representing security rules, as defined below.

tags {[key: string]: string}

A mapping of tags to assign to the resource.

resource_group_name str

The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.

location str

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name str

The name of the security rule.

security_rules List[NetworkSecurityGroupSecurityRule]

A list of objects representing security rules, as defined below.

tags Dict[str, str]

A mapping of tags to assign to the resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the NetworkSecurityGroup resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing NetworkSecurityGroup Resource

Get an existing NetworkSecurityGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

static get(resource_name, id, opts=None, location=None, name=None, resource_group_name=None, security_rules=None, tags=None, __props__=None);
func GetNetworkSecurityGroup(ctx *Context, name string, id IDInput, state *NetworkSecurityGroupState, opts ...ResourceOption) (*NetworkSecurityGroup, error)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

The name of the security rule.

ResourceGroupName string

The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.

SecurityRules List<NetworkSecurityGroupSecurityRuleArgs>

A list of objects representing security rules, as defined below.

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

Location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

The name of the security rule.

ResourceGroupName string

The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.

SecurityRules []NetworkSecurityGroupSecurityRule

A list of objects representing security rules, as defined below.

Tags map[string]string

A mapping of tags to assign to the resource.

location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name string

The name of the security rule.

resourceGroupName string

The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.

securityRules NetworkSecurityGroupSecurityRule[]

A list of objects representing security rules, as defined below.

tags {[key: string]: string}

A mapping of tags to assign to the resource.

location str

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name str

The name of the security rule.

resource_group_name str

The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.

security_rules List[NetworkSecurityGroupSecurityRule]

A list of objects representing security rules, as defined below.

tags Dict[str, str]

A mapping of tags to assign to the resource.

Supporting Types

NetworkSecurityGroupSecurityRule

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Access string

Specifies whether network traffic is allowed or denied. Possible values are Allow and Deny.

Direction string

The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are Inbound and Outbound.

Name string

The name of the security rule.

Priority int

Specifies 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.

Protocol string

Network protocol this rule applies to. Can be Tcp, Udp, Icmp, or * to match all.

Description string

A description for this rule. Restricted to 140 characters.

DestinationAddressPrefix string

CIDR or destination IP range or * to match any IP. Tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. This is required if destination_address_prefixes is not specified.

DestinationAddressPrefixes List<string>

List of destination address prefixes. Tags may not be used. This is required if destination_address_prefix is not specified.

DestinationApplicationSecurityGroupIds List<string>

A List of destination Application Security Group ID’s

DestinationPortRange string

Destination Port or Range. Integer or range between 0 and 65535 or * to match any. This is required if destination_port_ranges is not specified.

DestinationPortRanges List<string>

List of destination ports or port ranges. This is required if destination_port_range is not specified.

SourceAddressPrefix string

CIDR or source IP range or * to match any IP. Tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. This is required if source_address_prefixes is not specified.

SourceAddressPrefixes List<string>

List of source address prefixes. Tags may not be used. This is required if source_address_prefix is not specified.

SourceApplicationSecurityGroupIds List<string>

A List of source Application Security Group ID’s

SourcePortRange string

Source Port or Range. Integer or range between 0 and 65535 or * to match any. This is required if source_port_ranges is not specified.

SourcePortRanges List<string>

List of source ports or port ranges. This is required if source_port_range is not specified.

Access string

Specifies whether network traffic is allowed or denied. Possible values are Allow and Deny.

Direction string

The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are Inbound and Outbound.

Name string

The name of the security rule.

Priority int

Specifies 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.

Protocol string

Network protocol this rule applies to. Can be Tcp, Udp, Icmp, or * to match all.

Description string

A description for this rule. Restricted to 140 characters.

DestinationAddressPrefix string

CIDR or destination IP range or * to match any IP. Tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. This is required if destination_address_prefixes is not specified.

DestinationAddressPrefixes []string

List of destination address prefixes. Tags may not be used. This is required if destination_address_prefix is not specified.

DestinationApplicationSecurityGroupIds []string

A List of destination Application Security Group ID’s

DestinationPortRange string

Destination Port or Range. Integer or range between 0 and 65535 or * to match any. This is required if destination_port_ranges is not specified.

DestinationPortRanges []string

List of destination ports or port ranges. This is required if destination_port_range is not specified.

SourceAddressPrefix string

CIDR or source IP range or * to match any IP. Tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. This is required if source_address_prefixes is not specified.

SourceAddressPrefixes []string

List of source address prefixes. Tags may not be used. This is required if source_address_prefix is not specified.

SourceApplicationSecurityGroupIds []string

A List of source Application Security Group ID’s

SourcePortRange string

Source Port or Range. Integer or range between 0 and 65535 or * to match any. This is required if source_port_ranges is not specified.

SourcePortRanges []string

List of source ports or port ranges. This is required if source_port_range is not specified.

access string

Specifies whether network traffic is allowed or denied. Possible values are Allow and Deny.

direction string

The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are Inbound and Outbound.

name string

The name of the security rule.

priority number

Specifies 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.

protocol string

Network protocol this rule applies to. Can be Tcp, Udp, Icmp, or * to match all.

description string

A description for this rule. Restricted to 140 characters.

destinationAddressPrefix string

CIDR or destination IP range or * to match any IP. Tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. This is required if destination_address_prefixes is not specified.

destinationAddressPrefixes string[]

List of destination address prefixes. Tags may not be used. This is required if destination_address_prefix is not specified.

destinationApplicationSecurityGroupIds string[]

A List of destination Application Security Group ID’s

destinationPortRange string

Destination Port or Range. Integer or range between 0 and 65535 or * to match any. This is required if destination_port_ranges is not specified.

destinationPortRanges string[]

List of destination ports or port ranges. This is required if destination_port_range is not specified.

sourceAddressPrefix string

CIDR or source IP range or * to match any IP. Tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. This is required if source_address_prefixes is not specified.

sourceAddressPrefixes string[]

List of source address prefixes. Tags may not be used. This is required if source_address_prefix is not specified.

sourceApplicationSecurityGroupIds string[]

A List of source Application Security Group ID’s

sourcePortRange string

Source Port or Range. Integer or range between 0 and 65535 or * to match any. This is required if source_port_ranges is not specified.

sourcePortRanges string[]

List of source ports or port ranges. This is required if source_port_range is not specified.

access str

Specifies whether network traffic is allowed or denied. Possible values are Allow and Deny.

direction str

The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are Inbound and Outbound.

name str

The name of the security rule.

priority float

Specifies 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.

protocol str

Network protocol this rule applies to. Can be Tcp, Udp, Icmp, or * to match all.

description str

A description for this rule. Restricted to 140 characters.

destination_address_prefix str

CIDR or destination IP range or * to match any IP. Tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. This is required if destination_address_prefixes is not specified.

destination_address_prefixes List[str]

List of destination address prefixes. Tags may not be used. This is required if destination_address_prefix is not specified.

destination_application_security_group_ids List[str]

A List of destination Application Security Group ID’s

destination_port_range str

Destination Port or Range. Integer or range between 0 and 65535 or * to match any. This is required if destination_port_ranges is not specified.

destination_port_ranges List[str]

List of destination ports or port ranges. This is required if destination_port_range is not specified.

source_address_prefix str

CIDR or source IP range or * to match any IP. Tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. This is required if source_address_prefixes is not specified.

source_address_prefixes List[str]

List of source address prefixes. Tags may not be used. This is required if source_address_prefix is not specified.

source_application_security_group_ids List[str]

A List of source Application Security Group ID’s

source_port_range str

Source Port or Range. Integer or range between 0 and 65535 or * to match any. This is required if source_port_ranges is not specified.

source_port_ranges List[str]

List of source ports or port ranges. This is required if source_port_range is not specified.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.