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
new NetworkSecurityGroup(name: string, args: NetworkSecurityGroupArgs, opts?: CustomResourceOptions);def NetworkSecurityGroup(resource_name, opts=None, location=None, name=None, resource_group_name=None, security_rules=None, tags=None, __props__=None);func NewNetworkSecurityGroup(ctx *Context, name string, args NetworkSecurityGroupArgs, opts ...ResourceOption) (*NetworkSecurityGroup, error)public NetworkSecurityGroup(string name, NetworkSecurityGroupArgs args, CustomResourceOptions? opts = null)- 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:
- Resource
Group stringName 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.
- Security
Rules List<NetworkSecurity Group Security Rule Args> A list of objects representing security rules, as defined below.
- Dictionary<string, string>
A mapping of tags to assign to the resource.
- Resource
Group stringName 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.
- Security
Rules []NetworkSecurity Group Security Rule A list of objects representing security rules, as defined below.
- map[string]string
A mapping of tags to assign to the resource.
- resource
Group stringName 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.
- security
Rules NetworkSecurity Group Security Rule[] A list of objects representing security rules, as defined below.
- {[key: string]: string}
A mapping of tags to assign to the resource.
- resource_
group_ strname 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[NetworkSecurity Group Security Rule] A list of objects representing security rules, as defined below.
- 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:
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.
public static get(name: string, id: Input<ID>, state?: NetworkSecurityGroupState, opts?: CustomResourceOptions): NetworkSecurityGroupstatic 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)public static NetworkSecurityGroup Get(string name, Input<string> id, NetworkSecurityGroupState? state, CustomResourceOptions? opts = null)- 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.
- Resource
Group stringName 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<NetworkSecurity Group Security Rule Args> A list of objects representing security rules, as defined below.
- 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.
- Resource
Group stringName 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 []NetworkSecurity Group Security Rule A list of objects representing security rules, as defined below.
- 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.
- resource
Group stringName 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 NetworkSecurity Group Security Rule[] A list of objects representing security rules, as defined below.
- {[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_ strname 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[NetworkSecurity Group Security Rule] A list of objects representing security rules, as defined below.
- Dict[str, str]
A mapping of tags to assign to the resource.
Supporting Types
NetworkSecurityGroupSecurityRule
- Access string
Specifies whether network traffic is allowed or denied. Possible values are
AllowandDeny.- Direction string
The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are
InboundandOutbound.- 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.
- Destination
Address stringPrefix 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_prefixesis not specified.- Destination
Address List<string>Prefixes List of destination address prefixes. Tags may not be used. This is required if
destination_address_prefixis not specified.- Destination
Application List<string>Security Group Ids A List of destination Application Security Group ID’s
- Destination
Port stringRange Destination Port or Range. Integer or range between
0and65535or*to match any. This is required ifdestination_port_rangesis not specified.- Destination
Port List<string>Ranges List of destination ports or port ranges. This is required if
destination_port_rangeis not specified.- Source
Address stringPrefix 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_prefixesis not specified.- Source
Address List<string>Prefixes List of source address prefixes. Tags may not be used. This is required if
source_address_prefixis not specified.- Source
Application List<string>Security Group Ids A List of source Application Security Group ID’s
- Source
Port stringRange Source Port or Range. Integer or range between
0and65535or*to match any. This is required ifsource_port_rangesis not specified.- Source
Port List<string>Ranges List of source ports or port ranges. This is required if
source_port_rangeis not specified.
- Access string
Specifies whether network traffic is allowed or denied. Possible values are
AllowandDeny.- Direction string
The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are
InboundandOutbound.- 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.
- Destination
Address stringPrefix 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_prefixesis not specified.- Destination
Address []stringPrefixes List of destination address prefixes. Tags may not be used. This is required if
destination_address_prefixis not specified.- Destination
Application []stringSecurity Group Ids A List of destination Application Security Group ID’s
- Destination
Port stringRange Destination Port or Range. Integer or range between
0and65535or*to match any. This is required ifdestination_port_rangesis not specified.- Destination
Port []stringRanges List of destination ports or port ranges. This is required if
destination_port_rangeis not specified.- Source
Address stringPrefix 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_prefixesis not specified.- Source
Address []stringPrefixes List of source address prefixes. Tags may not be used. This is required if
source_address_prefixis not specified.- Source
Application []stringSecurity Group Ids A List of source Application Security Group ID’s
- Source
Port stringRange Source Port or Range. Integer or range between
0and65535or*to match any. This is required ifsource_port_rangesis not specified.- Source
Port []stringRanges List of source ports or port ranges. This is required if
source_port_rangeis not specified.
- access string
Specifies whether network traffic is allowed or denied. Possible values are
AllowandDeny.- direction string
The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are
InboundandOutbound.- 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.
- destination
Address stringPrefix 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_prefixesis not specified.- destination
Address string[]Prefixes List of destination address prefixes. Tags may not be used. This is required if
destination_address_prefixis not specified.- destination
Application string[]Security Group Ids A List of destination Application Security Group ID’s
- destination
Port stringRange Destination Port or Range. Integer or range between
0and65535or*to match any. This is required ifdestination_port_rangesis not specified.- destination
Port string[]Ranges List of destination ports or port ranges. This is required if
destination_port_rangeis not specified.- source
Address stringPrefix 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_prefixesis not specified.- source
Address string[]Prefixes List of source address prefixes. Tags may not be used. This is required if
source_address_prefixis not specified.- source
Application string[]Security Group Ids A List of source Application Security Group ID’s
- source
Port stringRange Source Port or Range. Integer or range between
0and65535or*to match any. This is required ifsource_port_rangesis not specified.- source
Port string[]Ranges List of source ports or port ranges. This is required if
source_port_rangeis not specified.
- access str
Specifies whether network traffic is allowed or denied. Possible values are
AllowandDeny.- direction str
The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are
InboundandOutbound.- 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_ strprefix 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_prefixesis not specified.- destination_
address_ List[str]prefixes List of destination address prefixes. Tags may not be used. This is required if
destination_address_prefixis not specified.- destination_
application_ List[str]security_ group_ ids A List of destination Application Security Group ID’s
- destination_
port_ strrange Destination Port or Range. Integer or range between
0and65535or*to match any. This is required ifdestination_port_rangesis not specified.- destination_
port_ List[str]ranges List of destination ports or port ranges. This is required if
destination_port_rangeis not specified.- source_
address_ strprefix 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_prefixesis not specified.- source_
address_ List[str]prefixes List of source address prefixes. Tags may not be used. This is required if
source_address_prefixis not specified.- source_
application_ List[str]security_ group_ ids A List of source Application Security Group ID’s
- source_
port_ strrange Source Port or Range. Integer or range between
0and65535or*to match any. This is required ifsource_port_rangesis not specified.- source_
port_ List[str]ranges List of source ports or port ranges. This is required if
source_port_rangeis not specified.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.