Show / Hide Table of Contents

Class NetworkSecurityRule

Manages a Network Security Rule.

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

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
public MyStack()
{
    var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
    {
        Location = "West US",
    });
    var exampleNetworkSecurityGroup = new Azure.Network.NetworkSecurityGroup("exampleNetworkSecurityGroup", new Azure.Network.NetworkSecurityGroupArgs
    {
        Location = exampleResourceGroup.Location,
        ResourceGroupName = exampleResourceGroup.Name,
    });
    var exampleNetworkSecurityRule = new Azure.Network.NetworkSecurityRule("exampleNetworkSecurityRule", new Azure.Network.NetworkSecurityRuleArgs
    {
        Priority = 100,
        Direction = "Outbound",
        Access = "Allow",
        Protocol = "Tcp",
        SourcePortRange = "*",
        DestinationPortRange = "*",
        SourceAddressPrefix = "*",
        DestinationAddressPrefix = "*",
        ResourceGroupName = exampleResourceGroup.Name,
        NetworkSecurityGroupName = exampleNetworkSecurityGroup.Name,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
NetworkSecurityRule
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Azure.Network
Assembly: Pulumi.Azure.dll
Syntax
public class NetworkSecurityRule : CustomResource

Constructors

View Source

NetworkSecurityRule(String, NetworkSecurityRuleArgs, CustomResourceOptions)

Create a NetworkSecurityRule resource with the given unique name, arguments, and options.

Declaration
public NetworkSecurityRule(string name, NetworkSecurityRuleArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

NetworkSecurityRuleArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Access

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

Declaration
public Output<string> Access { get; }
Property Value
Type Description
Output<System.String>
View Source

Description

A description for this rule. Restricted to 140 characters.

Declaration
public Output<string> Description { get; }
Property Value
Type Description
Output<System.String>
View Source

DestinationAddressPrefix

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.

Declaration
public Output<string> DestinationAddressPrefix { get; }
Property Value
Type Description
Output<System.String>
View Source

DestinationAddressPrefixes

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

Declaration
public Output<ImmutableArray<string>> DestinationAddressPrefixes { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

DestinationApplicationSecurityGroupIds

A List of destination Application Security Group ID's

Declaration
public Output<string> DestinationApplicationSecurityGroupIds { get; }
Property Value
Type Description
Output<System.String>
View Source

DestinationPortRange

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.

Declaration
public Output<string> DestinationPortRange { get; }
Property Value
Type Description
Output<System.String>
View Source

DestinationPortRanges

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

Declaration
public Output<ImmutableArray<string>> DestinationPortRanges { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

Direction

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

Declaration
public Output<string> Direction { get; }
Property Value
Type Description
Output<System.String>
View Source

Name

The name of the security rule. This needs to be unique across all Rules in the Network Security Group. Changing this forces a new resource to be created.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

NetworkSecurityGroupName

The name of the Network Security Group that we want to attach the rule to. Changing this forces a new resource to be created.

Declaration
public Output<string> NetworkSecurityGroupName { get; }
Property Value
Type Description
Output<System.String>
View Source

Priority

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.

Declaration
public Output<int> Priority { get; }
Property Value
Type Description
Output<System.Int32>
View Source

Protocol

Network protocol this rule applies to. Possible values include Tcp, Udp, Icmp, or * (which matches all).

Declaration
public Output<string> Protocol { get; }
Property Value
Type Description
Output<System.String>
View Source

ResourceGroupName

The name of the resource group in which to create the Network Security Rule. Changing this forces a new resource to be created.

Declaration
public Output<string> ResourceGroupName { get; }
Property Value
Type Description
Output<System.String>
View Source

SourceAddressPrefix

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.

Declaration
public Output<string> SourceAddressPrefix { get; }
Property Value
Type Description
Output<System.String>
View Source

SourceAddressPrefixes

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

Declaration
public Output<ImmutableArray<string>> SourceAddressPrefixes { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

SourceApplicationSecurityGroupIds

A List of source Application Security Group ID's

Declaration
public Output<string> SourceApplicationSecurityGroupIds { get; }
Property Value
Type Description
Output<System.String>
View Source

SourcePortRange

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.

Declaration
public Output<string> SourcePortRange { get; }
Property Value
Type Description
Output<System.String>
View Source

SourcePortRanges

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

Declaration
public Output<ImmutableArray<string>> SourcePortRanges { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>

Methods

View Source

Get(String, Input<String>, NetworkSecurityRuleState, CustomResourceOptions)

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

Declaration
public static NetworkSecurityRule Get(string name, Input<string> id, NetworkSecurityRuleState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

NetworkSecurityRuleState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
NetworkSecurityRule
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.