Security Rule Args
Network security rule. Uses Azure REST API version 2024-05-01. In version 2.x of the Azure Native provider, it used API version 2023-02-01. Other available API versions: 2018-06-01, 2018-07-01, 2018-08-01, 2018-10-01, 2018-11-01, 2018-12-01, 2019-02-01, 2019-04-01, 2019-06-01, 2019-07-01, 2019-08-01, 2019-09-01, 2019-11-01, 2019-12-01, 2020-03-01, 2020-04-01, 2020-05-01, 2020-06-01, 2020-07-01, 2020-08-01, 2020-11-01, 2021-02-01, 2021-03-01, 2021-05-01, 2021-08-01, 2022-01-01, 2022-05-01, 2022-07-01, 2022-09-01, 2022-11-01, 2023-02-01, 2023-04-01, 2023-05-01, 2023-06-01, 2023-09-01, 2023-11-01, 2024-01-01, 2024-03-01. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native network [ApiVersion]
. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.
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
Properties
The network traffic is allowed or denied.
A description for this rule. Restricted to 140 chars.
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.
The destination address prefixes. CIDR or destination IP ranges.
The application security group specified as destination.
The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
The destination port ranges.
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
The name of the network security group.
Network protocol this rule applies to.
The name of the resource group.
The name of the security rule.
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.
The CIDR or source IP ranges.
The application security group specified as source.
The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
The source port ranges.