SecurityRule

class SecurityRule : KotlinCustomResource

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}

Properties

Link copied to clipboard
val access: Output<String>

The network traffic is allowed or denied.

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

A description for this rule. Restricted to 140 chars.

Link copied to clipboard

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

The destination address prefixes. CIDR or destination IP ranges.

Link copied to clipboard

The application security group specified as destination.

Link copied to clipboard

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

The destination port ranges.

Link copied to clipboard
val direction: Output<String>

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

Link copied to clipboard
val etag: Output<String>

A unique read-only string that changes whenever the resource is updated.

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

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 priority: Output<Int>

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<String>

Network protocol this rule applies to.

Link copied to clipboard

The provisioning state of the security rule resource.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

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>?

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

The source port ranges.

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

The type of the resource.

Link copied to clipboard
val urn: Output<String>