SecurityRuleArgs

data class SecurityRuleArgs(val access: Output<Either<String, SecurityRuleAccess>>? = null, val description: Output<String>? = null, val destinationAddressPrefix: Output<String>? = null, val destinationAddressPrefixes: Output<List<String>>? = null, val destinationApplicationSecurityGroups: Output<List<ApplicationSecurityGroupArgs>>? = null, val destinationPortRange: Output<String>? = null, val destinationPortRanges: Output<List<String>>? = null, val direction: Output<Either<String, SecurityRuleDirection>>? = null, val id: Output<String>? = null, val name: Output<String>? = null, val networkSecurityGroupName: Output<String>? = null, val priority: Output<Int>? = null, val protocol: Output<Either<String, SecurityRuleProtocol>>? = null, val resourceGroupName: Output<String>? = null, val securityRuleName: Output<String>? = null, val sourceAddressPrefix: Output<String>? = null, val sourceAddressPrefixes: Output<List<String>>? = null, val sourceApplicationSecurityGroups: Output<List<ApplicationSecurityGroupArgs>>? = null, val sourcePortRange: Output<String>? = null, val sourcePortRanges: Output<List<String>>? = null, val type: Output<String>? = null) : ConvertibleToJava<SecurityRuleArgs>

Network security rule. Uses Azure REST API version 2023-02-01. In version 1.x of the Azure Native provider, it used API version 2020-11-01. Other available API versions: 2019-06-01, 2022-07-01, 2023-04-01, 2023-05-01, 2023-06-01, 2023-09-01, 2023-11-01, 2024-01-01, 2024-03-01, 2024-05-01.

Example Usage

Create security rule

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var securityRule = new AzureNative.Network.SecurityRule("securityRule", new()
{
Access = AzureNative.Network.SecurityRuleAccess.Deny,
DestinationAddressPrefix = "11.0.0.0/8",
DestinationPortRange = "8080",
Direction = AzureNative.Network.SecurityRuleDirection.Outbound,
NetworkSecurityGroupName = "testnsg",
Priority = 100,
Protocol = AzureNative.Network.SecurityRuleProtocol.Asterisk,
ResourceGroupName = "rg1",
SecurityRuleName = "rule1",
SourceAddressPrefix = "10.0.0.0/8",
SourcePortRange = "*",
});
});
package main
import (
network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := network.NewSecurityRule(ctx, "securityRule", &network.SecurityRuleArgs{
Access: pulumi.String(network.SecurityRuleAccessDeny),
DestinationAddressPrefix: pulumi.String("11.0.0.0/8"),
DestinationPortRange: pulumi.String("8080"),
Direction: pulumi.String(network.SecurityRuleDirectionOutbound),
NetworkSecurityGroupName: pulumi.String("testnsg"),
Priority: pulumi.Int(100),
Protocol: pulumi.String(network.SecurityRuleProtocolAsterisk),
ResourceGroupName: pulumi.String("rg1"),
SecurityRuleName: pulumi.String("rule1"),
SourceAddressPrefix: pulumi.String("10.0.0.0/8"),
SourcePortRange: pulumi.String("*"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.network.SecurityRule;
import com.pulumi.azurenative.network.SecurityRuleArgs;
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 securityRule = new SecurityRule("securityRule", SecurityRuleArgs.builder()
.access("Deny")
.destinationAddressPrefix("11.0.0.0/8")
.destinationPortRange("8080")
.direction("Outbound")
.networkSecurityGroupName("testnsg")
.priority(100)
.protocol("*")
.resourceGroupName("rg1")
.securityRuleName("rule1")
.sourceAddressPrefix("10.0.0.0/8")
.sourcePortRange("*")
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:network:SecurityRule rule1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}

Constructors

Link copied to clipboard
constructor(access: Output<Either<String, SecurityRuleAccess>>? = null, description: Output<String>? = null, destinationAddressPrefix: Output<String>? = null, destinationAddressPrefixes: Output<List<String>>? = null, destinationApplicationSecurityGroups: Output<List<ApplicationSecurityGroupArgs>>? = null, destinationPortRange: Output<String>? = null, destinationPortRanges: Output<List<String>>? = null, direction: Output<Either<String, SecurityRuleDirection>>? = null, id: Output<String>? = null, name: Output<String>? = null, networkSecurityGroupName: Output<String>? = null, priority: Output<Int>? = null, protocol: Output<Either<String, SecurityRuleProtocol>>? = null, resourceGroupName: Output<String>? = null, securityRuleName: Output<String>? = null, sourceAddressPrefix: Output<String>? = null, sourceAddressPrefixes: Output<List<String>>? = null, sourceApplicationSecurityGroups: Output<List<ApplicationSecurityGroupArgs>>? = null, sourcePortRange: Output<String>? = null, sourcePortRanges: Output<List<String>>? = null, type: Output<String>? = null)

Properties

Link copied to clipboard
val access: Output<Either<String, SecurityRuleAccess>>? = null

The network traffic is allowed or denied.

Link copied to clipboard
val description: Output<String>? = null

A description for this rule. Restricted to 140 chars.

Link copied to clipboard
val destinationAddressPrefix: Output<String>? = null

The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.

Link copied to clipboard
val destinationAddressPrefixes: Output<List<String>>? = null

The destination address prefixes. CIDR or destination IP ranges.

Link copied to clipboard

The application security group specified as destination.

Link copied to clipboard
val destinationPortRange: Output<String>? = null

The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.

Link copied to clipboard
val destinationPortRanges: Output<List<String>>? = null

The destination port ranges.

Link copied to clipboard
val direction: Output<Either<String, SecurityRuleDirection>>? = null

The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.

Link copied to clipboard
val id: Output<String>? = null

Resource ID.

Link copied to clipboard
val name: Output<String>? = null

The name of the resource that is unique within a resource group. This name can be used to access the resource.

Link copied to clipboard
val networkSecurityGroupName: Output<String>? = null

The name of the network security group.

Link copied to clipboard
val priority: Output<Int>? = null

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.

Link copied to clipboard
val protocol: Output<Either<String, SecurityRuleProtocol>>? = null

Network protocol this rule applies to.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group.

Link copied to clipboard
val securityRuleName: Output<String>? = null

The name of the security rule.

Link copied to clipboard
val sourceAddressPrefix: Output<String>? = null

The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.

Link copied to clipboard
val sourceAddressPrefixes: Output<List<String>>? = null

The CIDR or source IP ranges.

Link copied to clipboard

The application security group specified as source.

Link copied to clipboard
val sourcePortRange: Output<String>? = null

The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.

Link copied to clipboard
val sourcePortRanges: Output<List<String>>? = null

The source port ranges.

Link copied to clipboard
val type: Output<String>? = null

The type of the resource.

Functions

Link copied to clipboard
open override fun toJava(): SecurityRuleArgs