Security Rule Args
Security Rule resource. Uses Azure REST API version 2025-02-01-preview. In version 2.x of the Azure Native provider, it used API version 2024-02-01-preview. Other available API versions: 2024-02-01-preview, 2024-05-01-preview, 2024-07-15-preview, 2024-08-01-preview, 2024-10-01-preview, 2025-04-01-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native azurestackhci [ApiVersion]
. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.
Example Usage
SecurityRulesCreateOrUpdate
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var securityRule = new AzureNative.AzureStackHCI.SecurityRule("securityRule", new()
{
Access = AzureNative.AzureStackHCI.SecurityRuleAccess.Allow,
DestinationAddressPrefixes = new[]
{
"*",
},
DestinationPortRanges = new[]
{
"80",
},
Direction = AzureNative.AzureStackHCI.SecurityRuleDirection.Inbound,
ExtendedLocation = new AzureNative.AzureStackHCI.Inputs.ExtendedLocationArgs
{
Name = "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location",
Type = AzureNative.AzureStackHCI.ExtendedLocationTypes.CustomLocation,
},
NetworkSecurityGroupName = "testnsg",
Priority = 130,
Protocol = AzureNative.AzureStackHCI.SecurityRuleProtocol.Asterisk,
ResourceGroupName = "testrg",
SecurityRuleName = "rule1",
SourceAddressPrefixes = new[]
{
"*",
},
SourcePortRanges = new[]
{
"*",
},
});
});
package main
import (
azurestackhci "github.com/pulumi/pulumi-azure-native-sdk/azurestackhci/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := azurestackhci.NewSecurityRule(ctx, "securityRule", &azurestackhci.SecurityRuleArgs{
Access: pulumi.String(azurestackhci.SecurityRuleAccessAllow),
DestinationAddressPrefixes: pulumi.StringArray{
pulumi.String("*"),
},
DestinationPortRanges: pulumi.StringArray{
pulumi.String("80"),
},
Direction: pulumi.String(azurestackhci.SecurityRuleDirectionInbound),
ExtendedLocation: &azurestackhci.ExtendedLocationArgs{
Name: pulumi.String("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"),
Type: pulumi.String(azurestackhci.ExtendedLocationTypesCustomLocation),
},
NetworkSecurityGroupName: pulumi.String("testnsg"),
Priority: pulumi.Int(130),
Protocol: pulumi.String(azurestackhci.SecurityRuleProtocolAsterisk),
ResourceGroupName: pulumi.String("testrg"),
SecurityRuleName: pulumi.String("rule1"),
SourceAddressPrefixes: pulumi.StringArray{
pulumi.String("*"),
},
SourcePortRanges: pulumi.StringArray{
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.azurestackhci.SecurityRule;
import com.pulumi.azurenative.azurestackhci.SecurityRuleArgs;
import com.pulumi.azurenative.azurestackhci.inputs.ExtendedLocationArgs;
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("Allow")
.destinationAddressPrefixes("*")
.destinationPortRanges("80")
.direction("Inbound")
.extendedLocation(ExtendedLocationArgs.builder()
.name("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location")
.type("CustomLocation")
.build())
.networkSecurityGroupName("testnsg")
.priority(130)
.protocol("*")
.resourceGroupName("testrg")
.securityRuleName("rule1")
.sourceAddressPrefixes("*")
.sourcePortRanges("*")
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:azurestackhci:SecurityRule rule1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/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 prefixes. CIDR or destination IP ranges.
The destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
The extendedLocation of the resource.
Name of the network security group
Network protocol this rule applies to.
The name of the resource group. The name is case insensitive.
Name of the security rule.
The CIDR or source IP ranges.
The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.