SecurityRule

class SecurityRule : KotlinCustomResource

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}

Properties

Link copied to clipboard
val access: Output<String>

The network traffic is allowed or denied.

Link copied to clipboard
val azureApiVersion: Output<String>

The Azure API version of the resource.

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

A description for this rule. Restricted to 140 chars.

Link copied to clipboard

The destination address prefixes. CIDR or destination IP ranges.

Link copied to clipboard

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

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

The extendedLocation of the resource.

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

The name of 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

Provisioning state of the SR

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 ranges.

Link copied to clipboard

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

Link copied to clipboard

Azure Resource Manager metadata containing createdBy and modifiedBy information.

Link copied to clipboard
val type: Output<String>

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

Link copied to clipboard
val urn: Output<String>