We recommend using Azure Native.
azure.network.NetworkSecurityGroup
Explore with Pulumi AI
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.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
    name: "example-resources",
    location: "West Europe",
});
const exampleNetworkSecurityGroup = new azure.network.NetworkSecurityGroup("example", {
    name: "acceptanceTestSecurityGroup1",
    location: example.location,
    resourceGroupName: example.name,
    securityRules: [{
        name: "test123",
        priority: 100,
        direction: "Inbound",
        access: "Allow",
        protocol: "Tcp",
        sourcePortRange: "*",
        destinationPortRange: "*",
        sourceAddressPrefix: "*",
        destinationAddressPrefix: "*",
    }],
    tags: {
        environment: "Production",
    },
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
example_network_security_group = azure.network.NetworkSecurityGroup("example",
    name="acceptanceTestSecurityGroup1",
    location=example.location,
    resource_group_name=example.name,
    security_rules=[{
        "name": "test123",
        "priority": 100,
        "direction": "Inbound",
        "access": "Allow",
        "protocol": "Tcp",
        "source_port_range": "*",
        "destination_port_range": "*",
        "source_address_prefix": "*",
        "destination_address_prefix": "*",
    }],
    tags={
        "environment": "Production",
    })
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example-resources"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		_, err = network.NewNetworkSecurityGroup(ctx, "example", &network.NetworkSecurityGroupArgs{
			Name:              pulumi.String("acceptanceTestSecurityGroup1"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			SecurityRules: network.NetworkSecurityGroupSecurityRuleArray{
				&network.NetworkSecurityGroupSecurityRuleArgs{
					Name:                     pulumi.String("test123"),
					Priority:                 pulumi.Int(100),
					Direction:                pulumi.String("Inbound"),
					Access:                   pulumi.String("Allow"),
					Protocol:                 pulumi.String("Tcp"),
					SourcePortRange:          pulumi.String("*"),
					DestinationPortRange:     pulumi.String("*"),
					SourceAddressPrefix:      pulumi.String("*"),
					DestinationAddressPrefix: pulumi.String("*"),
				},
			},
			Tags: pulumi.StringMap{
				"environment": pulumi.String("Production"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-resources",
        Location = "West Europe",
    });
    var exampleNetworkSecurityGroup = new Azure.Network.NetworkSecurityGroup("example", new()
    {
        Name = "acceptanceTestSecurityGroup1",
        Location = example.Location,
        ResourceGroupName = example.Name,
        SecurityRules = new[]
        {
            new Azure.Network.Inputs.NetworkSecurityGroupSecurityRuleArgs
            {
                Name = "test123",
                Priority = 100,
                Direction = "Inbound",
                Access = "Allow",
                Protocol = "Tcp",
                SourcePortRange = "*",
                DestinationPortRange = "*",
                SourceAddressPrefix = "*",
                DestinationAddressPrefix = "*",
            },
        },
        Tags = 
        {
            { "environment", "Production" },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.NetworkSecurityGroup;
import com.pulumi.azure.network.NetworkSecurityGroupArgs;
import com.pulumi.azure.network.inputs.NetworkSecurityGroupSecurityRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("example-resources")
            .location("West Europe")
            .build());
        var exampleNetworkSecurityGroup = new NetworkSecurityGroup("exampleNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
            .name("acceptanceTestSecurityGroup1")
            .location(example.location())
            .resourceGroupName(example.name())
            .securityRules(NetworkSecurityGroupSecurityRuleArgs.builder()
                .name("test123")
                .priority(100)
                .direction("Inbound")
                .access("Allow")
                .protocol("Tcp")
                .sourcePortRange("*")
                .destinationPortRange("*")
                .sourceAddressPrefix("*")
                .destinationAddressPrefix("*")
                .build())
            .tags(Map.of("environment", "Production"))
            .build());
    }
}
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleNetworkSecurityGroup:
    type: azure:network:NetworkSecurityGroup
    name: example
    properties:
      name: acceptanceTestSecurityGroup1
      location: ${example.location}
      resourceGroupName: ${example.name}
      securityRules:
        - name: test123
          priority: 100
          direction: Inbound
          access: Allow
          protocol: Tcp
          sourcePortRange: '*'
          destinationPortRange: '*'
          sourceAddressPrefix: '*'
          destinationAddressPrefix: '*'
      tags:
        environment: Production
Create NetworkSecurityGroup Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NetworkSecurityGroup(name: string, args: NetworkSecurityGroupArgs, opts?: CustomResourceOptions);@overload
def NetworkSecurityGroup(resource_name: str,
                         args: NetworkSecurityGroupArgs,
                         opts: Optional[ResourceOptions] = None)
@overload
def NetworkSecurityGroup(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         resource_group_name: Optional[str] = None,
                         location: Optional[str] = None,
                         name: Optional[str] = None,
                         security_rules: Optional[Sequence[NetworkSecurityGroupSecurityRuleArgs]] = None,
                         tags: Optional[Mapping[str, str]] = None)func NewNetworkSecurityGroup(ctx *Context, name string, args NetworkSecurityGroupArgs, opts ...ResourceOption) (*NetworkSecurityGroup, error)public NetworkSecurityGroup(string name, NetworkSecurityGroupArgs args, CustomResourceOptions? opts = null)
public NetworkSecurityGroup(String name, NetworkSecurityGroupArgs args)
public NetworkSecurityGroup(String name, NetworkSecurityGroupArgs args, CustomResourceOptions options)
type: azure:network:NetworkSecurityGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- 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.
- args NetworkSecurityGroupArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control 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.
- name String
- The unique name of the resource.
- args NetworkSecurityGroupArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var networkSecurityGroupResource = new Azure.Network.NetworkSecurityGroup("networkSecurityGroupResource", new()
{
    ResourceGroupName = "string",
    Location = "string",
    Name = "string",
    SecurityRules = new[]
    {
        new Azure.Network.Inputs.NetworkSecurityGroupSecurityRuleArgs
        {
            Direction = "string",
            Protocol = "string",
            Priority = 0,
            Name = "string",
            Access = "string",
            DestinationApplicationSecurityGroupIds = new[]
            {
                "string",
            },
            DestinationPortRanges = new[]
            {
                "string",
            },
            DestinationPortRange = "string",
            DestinationAddressPrefixes = new[]
            {
                "string",
            },
            DestinationAddressPrefix = "string",
            Description = "string",
            SourceAddressPrefix = "string",
            SourceAddressPrefixes = new[]
            {
                "string",
            },
            SourceApplicationSecurityGroupIds = new[]
            {
                "string",
            },
            SourcePortRange = "string",
            SourcePortRanges = new[]
            {
                "string",
            },
        },
    },
    Tags = 
    {
        { "string", "string" },
    },
});
example, err := network.NewNetworkSecurityGroup(ctx, "networkSecurityGroupResource", &network.NetworkSecurityGroupArgs{
	ResourceGroupName: pulumi.String("string"),
	Location:          pulumi.String("string"),
	Name:              pulumi.String("string"),
	SecurityRules: network.NetworkSecurityGroupSecurityRuleArray{
		&network.NetworkSecurityGroupSecurityRuleArgs{
			Direction: pulumi.String("string"),
			Protocol:  pulumi.String("string"),
			Priority:  pulumi.Int(0),
			Name:      pulumi.String("string"),
			Access:    pulumi.String("string"),
			DestinationApplicationSecurityGroupIds: pulumi.StringArray{
				pulumi.String("string"),
			},
			DestinationPortRanges: pulumi.StringArray{
				pulumi.String("string"),
			},
			DestinationPortRange: pulumi.String("string"),
			DestinationAddressPrefixes: pulumi.StringArray{
				pulumi.String("string"),
			},
			DestinationAddressPrefix: pulumi.String("string"),
			Description:              pulumi.String("string"),
			SourceAddressPrefix:      pulumi.String("string"),
			SourceAddressPrefixes: pulumi.StringArray{
				pulumi.String("string"),
			},
			SourceApplicationSecurityGroupIds: pulumi.StringArray{
				pulumi.String("string"),
			},
			SourcePortRange: pulumi.String("string"),
			SourcePortRanges: pulumi.StringArray{
				pulumi.String("string"),
			},
		},
	},
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
var networkSecurityGroupResource = new NetworkSecurityGroup("networkSecurityGroupResource", NetworkSecurityGroupArgs.builder()
    .resourceGroupName("string")
    .location("string")
    .name("string")
    .securityRules(NetworkSecurityGroupSecurityRuleArgs.builder()
        .direction("string")
        .protocol("string")
        .priority(0)
        .name("string")
        .access("string")
        .destinationApplicationSecurityGroupIds("string")
        .destinationPortRanges("string")
        .destinationPortRange("string")
        .destinationAddressPrefixes("string")
        .destinationAddressPrefix("string")
        .description("string")
        .sourceAddressPrefix("string")
        .sourceAddressPrefixes("string")
        .sourceApplicationSecurityGroupIds("string")
        .sourcePortRange("string")
        .sourcePortRanges("string")
        .build())
    .tags(Map.of("string", "string"))
    .build());
network_security_group_resource = azure.network.NetworkSecurityGroup("networkSecurityGroupResource",
    resource_group_name="string",
    location="string",
    name="string",
    security_rules=[{
        "direction": "string",
        "protocol": "string",
        "priority": 0,
        "name": "string",
        "access": "string",
        "destination_application_security_group_ids": ["string"],
        "destination_port_ranges": ["string"],
        "destination_port_range": "string",
        "destination_address_prefixes": ["string"],
        "destination_address_prefix": "string",
        "description": "string",
        "source_address_prefix": "string",
        "source_address_prefixes": ["string"],
        "source_application_security_group_ids": ["string"],
        "source_port_range": "string",
        "source_port_ranges": ["string"],
    }],
    tags={
        "string": "string",
    })
const networkSecurityGroupResource = new azure.network.NetworkSecurityGroup("networkSecurityGroupResource", {
    resourceGroupName: "string",
    location: "string",
    name: "string",
    securityRules: [{
        direction: "string",
        protocol: "string",
        priority: 0,
        name: "string",
        access: "string",
        destinationApplicationSecurityGroupIds: ["string"],
        destinationPortRanges: ["string"],
        destinationPortRange: "string",
        destinationAddressPrefixes: ["string"],
        destinationAddressPrefix: "string",
        description: "string",
        sourceAddressPrefix: "string",
        sourceAddressPrefixes: ["string"],
        sourceApplicationSecurityGroupIds: ["string"],
        sourcePortRange: "string",
        sourcePortRanges: ["string"],
    }],
    tags: {
        string: "string",
    },
});
type: azure:network:NetworkSecurityGroup
properties:
    location: string
    name: string
    resourceGroupName: string
    securityRules:
        - access: string
          description: string
          destinationAddressPrefix: string
          destinationAddressPrefixes:
            - string
          destinationApplicationSecurityGroupIds:
            - string
          destinationPortRange: string
          destinationPortRanges:
            - string
          direction: string
          name: string
          priority: 0
          protocol: string
          sourceAddressPrefix: string
          sourceAddressPrefixes:
            - string
          sourceApplicationSecurityGroupIds:
            - string
          sourcePortRange: string
          sourcePortRanges:
            - string
    tags:
        string: string
NetworkSecurityGroup Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The NetworkSecurityGroup resource accepts the following input properties:
- ResourceGroup 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.
- SecurityRules List<NetworkSecurity Group Security Rule> 
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- ResourceGroup 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.
- SecurityRules []NetworkSecurity Group Security Rule Args 
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- map[string]string
- A mapping of tags to assign to the resource.
- resourceGroup 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.
- securityRules List<NetworkSecurity Group Security Rule> 
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- Map<String,String>
- A mapping of tags to assign to the resource.
- resourceGroup 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.
- securityRules NetworkSecurity Group Security Rule[] 
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- {[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 Sequence[NetworkSecurity Group Security Rule Args] 
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- resourceGroup 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.
- securityRules List<Property Map>
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- Map<String>
- 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 string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up 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): NetworkSecurityGroup@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        location: Optional[str] = None,
        name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        security_rules: Optional[Sequence[NetworkSecurityGroupSecurityRuleArgs]] = None,
        tags: Optional[Mapping[str, str]] = None) -> NetworkSecurityGroupfunc 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)public static NetworkSecurityGroup get(String name, Output<String> id, NetworkSecurityGroupState state, CustomResourceOptions options)resources:  _:    type: azure:network:NetworkSecurityGroup    get:      id: ${id}- 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.
- 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.
- 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.
- ResourceGroup stringName 
- 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<NetworkSecurity Group Security Rule> 
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- 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.
- ResourceGroup stringName 
- The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.
- SecurityRules []NetworkSecurity Group Security Rule Args 
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- 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.
- resourceGroup StringName 
- 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<NetworkSecurity Group Security Rule> 
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- 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.
- resourceGroup stringName 
- The name of the resource group in which to create the network security group. Changing this forces a new resource to be created.
- securityRules NetworkSecurity Group Security Rule[] 
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- {[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 Sequence[NetworkSecurity Group Security Rule Args] 
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- Mapping[str, str]
- 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.
- resourceGroup StringName 
- 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<Property Map>
- A list of objects representing security rules, as defined below. - NOTE Since - security_rulecan be configured both inline and via the separate- azure.network.NetworkSecurityRuleresource, we have to explicitly set it to empty slice (- []) to remove it.
- Map<String>
- A mapping of tags to assign to the resource.
Supporting Types
NetworkSecurityGroupSecurityRule, NetworkSecurityGroupSecurityRuleArgs          
- 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. Possible values include Tcp,Udp,Icmp,Esp,Ahor*(which matches all).
- Description string
- A description for this rule. Restricted to 140 characters.
- DestinationAddress stringPrefix 
- CIDR or destination IP range or * to match any IP. Tags such as VirtualNetwork,AzureLoadBalancerandInternetcan also be used. This is required ifdestination_address_prefixesis not specified.
- DestinationAddress List<string>Prefixes 
- List of destination address prefixes. Tags may not be used. This is required if destination_address_prefixis not specified.
- DestinationApplication List<string>Security Group Ids 
- A List of destination Application Security Group IDs
- DestinationPort stringRange 
- Destination Port or Range. Integer or range between 0and65535or*to match any. This is required ifdestination_port_rangesis not specified.
- DestinationPort List<string>Ranges 
- List of destination ports or port ranges. This is required if destination_port_rangeis not specified.
- SourceAddress stringPrefix 
- CIDR or source IP range or * to match any IP. Tags such as VirtualNetwork,AzureLoadBalancerandInternetcan also be used. This is required ifsource_address_prefixesis not specified.
- SourceAddress List<string>Prefixes 
- List of source address prefixes. Tags may not be used. This is required if source_address_prefixis not specified.
- SourceApplication List<string>Security Group Ids 
- A List of source Application Security Group IDs
- SourcePort stringRange 
- Source Port or Range. Integer or range between 0and65535or*to match any. This is required ifsource_port_rangesis not specified.
- SourcePort 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. Possible values include Tcp,Udp,Icmp,Esp,Ahor*(which matches all).
- Description string
- A description for this rule. Restricted to 140 characters.
- DestinationAddress stringPrefix 
- CIDR or destination IP range or * to match any IP. Tags such as VirtualNetwork,AzureLoadBalancerandInternetcan also be used. This is required ifdestination_address_prefixesis not specified.
- DestinationAddress []stringPrefixes 
- List of destination address prefixes. Tags may not be used. This is required if destination_address_prefixis not specified.
- DestinationApplication []stringSecurity Group Ids 
- A List of destination Application Security Group IDs
- DestinationPort stringRange 
- Destination Port or Range. Integer or range between 0and65535or*to match any. This is required ifdestination_port_rangesis not specified.
- DestinationPort []stringRanges 
- List of destination ports or port ranges. This is required if destination_port_rangeis not specified.
- SourceAddress stringPrefix 
- CIDR or source IP range or * to match any IP. Tags such as VirtualNetwork,AzureLoadBalancerandInternetcan also be used. This is required ifsource_address_prefixesis not specified.
- SourceAddress []stringPrefixes 
- List of source address prefixes. Tags may not be used. This is required if source_address_prefixis not specified.
- SourceApplication []stringSecurity Group Ids 
- A List of source Application Security Group IDs
- SourcePort stringRange 
- Source Port or Range. Integer or range between 0and65535or*to match any. This is required ifsource_port_rangesis not specified.
- SourcePort []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 Integer
- 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. Possible values include Tcp,Udp,Icmp,Esp,Ahor*(which matches all).
- description String
- A description for this rule. Restricted to 140 characters.
- destinationAddress StringPrefix 
- CIDR or destination IP range or * to match any IP. Tags such as VirtualNetwork,AzureLoadBalancerandInternetcan also be used. This is required ifdestination_address_prefixesis not specified.
- destinationAddress List<String>Prefixes 
- List of destination address prefixes. Tags may not be used. This is required if destination_address_prefixis not specified.
- destinationApplication List<String>Security Group Ids 
- A List of destination Application Security Group IDs
- destinationPort StringRange 
- Destination Port or Range. Integer or range between 0and65535or*to match any. This is required ifdestination_port_rangesis not specified.
- destinationPort List<String>Ranges 
- List of destination ports or port ranges. This is required if destination_port_rangeis not specified.
- sourceAddress StringPrefix 
- CIDR or source IP range or * to match any IP. Tags such as VirtualNetwork,AzureLoadBalancerandInternetcan also be used. This is required ifsource_address_prefixesis not specified.
- sourceAddress List<String>Prefixes 
- List of source address prefixes. Tags may not be used. This is required if source_address_prefixis not specified.
- sourceApplication List<String>Security Group Ids 
- A List of source Application Security Group IDs
- sourcePort StringRange 
- Source Port or Range. Integer or range between 0and65535or*to match any. This is required ifsource_port_rangesis not specified.
- sourcePort 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 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. Possible values include Tcp,Udp,Icmp,Esp,Ahor*(which matches all).
- description string
- A description for this rule. Restricted to 140 characters.
- destinationAddress stringPrefix 
- CIDR or destination IP range or * to match any IP. Tags such as VirtualNetwork,AzureLoadBalancerandInternetcan also be used. This is required ifdestination_address_prefixesis not specified.
- destinationAddress string[]Prefixes 
- List of destination address prefixes. Tags may not be used. This is required if destination_address_prefixis not specified.
- destinationApplication string[]Security Group Ids 
- A List of destination Application Security Group IDs
- destinationPort stringRange 
- Destination Port or Range. Integer or range between 0and65535or*to match any. This is required ifdestination_port_rangesis not specified.
- destinationPort string[]Ranges 
- List of destination ports or port ranges. This is required if destination_port_rangeis not specified.
- sourceAddress stringPrefix 
- CIDR or source IP range or * to match any IP. Tags such as VirtualNetwork,AzureLoadBalancerandInternetcan also be used. This is required ifsource_address_prefixesis not specified.
- sourceAddress string[]Prefixes 
- List of source address prefixes. Tags may not be used. This is required if source_address_prefixis not specified.
- sourceApplication string[]Security Group Ids 
- A List of source Application Security Group IDs
- sourcePort stringRange 
- Source Port or Range. Integer or range between 0and65535or*to match any. This is required ifsource_port_rangesis not specified.
- sourcePort 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 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 str
- Network protocol this rule applies to. Possible values include Tcp,Udp,Icmp,Esp,Ahor*(which matches 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,AzureLoadBalancerandInternetcan also be used. This is required ifdestination_address_prefixesis not specified.
- destination_address_ Sequence[str]prefixes 
- List of destination address prefixes. Tags may not be used. This is required if destination_address_prefixis not specified.
- destination_application_ Sequence[str]security_ group_ ids 
- A List of destination Application Security Group IDs
- 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_ Sequence[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,AzureLoadBalancerandInternetcan also be used. This is required ifsource_address_prefixesis not specified.
- source_address_ Sequence[str]prefixes 
- List of source address prefixes. Tags may not be used. This is required if source_address_prefixis not specified.
- source_application_ Sequence[str]security_ group_ ids 
- A List of source Application Security Group IDs
- 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_ Sequence[str]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 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. Possible values include Tcp,Udp,Icmp,Esp,Ahor*(which matches all).
- description String
- A description for this rule. Restricted to 140 characters.
- destinationAddress StringPrefix 
- CIDR or destination IP range or * to match any IP. Tags such as VirtualNetwork,AzureLoadBalancerandInternetcan also be used. This is required ifdestination_address_prefixesis not specified.
- destinationAddress List<String>Prefixes 
- List of destination address prefixes. Tags may not be used. This is required if destination_address_prefixis not specified.
- destinationApplication List<String>Security Group Ids 
- A List of destination Application Security Group IDs
- destinationPort StringRange 
- Destination Port or Range. Integer or range between 0and65535or*to match any. This is required ifdestination_port_rangesis not specified.
- destinationPort List<String>Ranges 
- List of destination ports or port ranges. This is required if destination_port_rangeis not specified.
- sourceAddress StringPrefix 
- CIDR or source IP range or * to match any IP. Tags such as VirtualNetwork,AzureLoadBalancerandInternetcan also be used. This is required ifsource_address_prefixesis not specified.
- sourceAddress List<String>Prefixes 
- List of source address prefixes. Tags may not be used. This is required if source_address_prefixis not specified.
- sourceApplication List<String>Security Group Ids 
- A List of source Application Security Group IDs
- sourcePort StringRange 
- Source Port or Range. Integer or range between 0and65535or*to match any. This is required ifsource_port_rangesis not specified.
- sourcePort List<String>Ranges 
- List of source ports or port ranges. This is required if source_port_rangeis not specified.
Import
Network Security Groups can be imported using the resource id, e.g.
$ pulumi import azure:network/networkSecurityGroup:NetworkSecurityGroup group1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkSecurityGroups/mySecurityGroup
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.