Network Security Rule Args
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
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.NetworkSecurityRule;
import com.pulumi.azure.network.NetworkSecurityRuleArgs;
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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleNetworkSecurityGroup = new NetworkSecurityGroup("exampleNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.build());
var exampleNetworkSecurityRule = new NetworkSecurityRule("exampleNetworkSecurityRule", NetworkSecurityRuleArgs.builder()
.priority(100)
.direction("Outbound")
.access("Allow")
.protocol("Tcp")
.sourcePortRange("*")
.destinationPortRange("*")
.sourceAddressPrefix("*")
.destinationAddressPrefix("*")
.resourceGroupName(exampleResourceGroup.name())
.networkSecurityGroupName(exampleNetworkSecurityGroup.name())
.build());
}
}
Import
Network Security Rules can be imported using the resource id
, e.g.
$ pulumi import azure:network/networkSecurityRule:NetworkSecurityRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkSecurityGroups/mySecurityGroup/securityRules/rule1
Constructors
Functions
Properties
CIDR or destination IP range or * to match any IP. Tags such as VirtualNetwork
, AzureLoadBalancer
and Internet
can also be used. Besides, it also supports all available Service Tags like ‘Sql.WestEurope‘, ‘Storage.EastUS‘, etc. You can list the available service tags with the CLI: ``shell az network list-service-tags --location westcentralus``
. For further information please see Azure CLI - az network list-service-tags. This is required if destination_address_prefixes
is not specified. @property destinationAddressPrefixes List of destination address prefixes. Tags may not be used. This is required if destination_address_prefix
is not specified. @property destinationApplicationSecurityGroupIds A List of destination Application Security Group IDs @property 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. @property destinationPortRanges List of destination ports or port ranges. This is required if destination_port_range
is not specified. @property direction The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are Inbound
and Outbound
. @property 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. @property 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. @property 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. @property protocol Network protocol this rule applies to. Possible values include Tcp
, Udp
, Icmp
, Esp
, Ah
or *
(which matches all). @property resourceGroupName The name of the resource group in which to create the Network Security Rule. Changing this forces a new resource to be created. @property 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. @property sourceAddressPrefixes List of source address prefixes. Tags may not be used. This is required if source_address_prefix
is not specified. @property sourceApplicationSecurityGroupIds A List of source Application Security Group IDs @property 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. @property sourcePortRanges List of source ports or port ranges. This is required if source_port_range
is not specified.