1. Packages
  2. Azure Native
  3. API Docs
  4. network
  5. getSecurityRule
This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.2.0 published on Monday, Apr 14, 2025 by Pulumi

azure-native.network.getSecurityRule

Explore with Pulumi AI

This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.2.0 published on Monday, Apr 14, 2025 by Pulumi

Get the specified network security rule.

Uses Azure REST API version 2024-05-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 for details.

Using getSecurityRule

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getSecurityRule(args: GetSecurityRuleArgs, opts?: InvokeOptions): Promise<GetSecurityRuleResult>
function getSecurityRuleOutput(args: GetSecurityRuleOutputArgs, opts?: InvokeOptions): Output<GetSecurityRuleResult>
Copy
def get_security_rule(network_security_group_name: Optional[str] = None,
                      resource_group_name: Optional[str] = None,
                      security_rule_name: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetSecurityRuleResult
def get_security_rule_output(network_security_group_name: Optional[pulumi.Input[str]] = None,
                      resource_group_name: Optional[pulumi.Input[str]] = None,
                      security_rule_name: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetSecurityRuleResult]
Copy
func LookupSecurityRule(ctx *Context, args *LookupSecurityRuleArgs, opts ...InvokeOption) (*LookupSecurityRuleResult, error)
func LookupSecurityRuleOutput(ctx *Context, args *LookupSecurityRuleOutputArgs, opts ...InvokeOption) LookupSecurityRuleResultOutput
Copy

> Note: This function is named LookupSecurityRule in the Go SDK.

public static class GetSecurityRule 
{
    public static Task<GetSecurityRuleResult> InvokeAsync(GetSecurityRuleArgs args, InvokeOptions? opts = null)
    public static Output<GetSecurityRuleResult> Invoke(GetSecurityRuleInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetSecurityRuleResult> getSecurityRule(GetSecurityRuleArgs args, InvokeOptions options)
public static Output<GetSecurityRuleResult> getSecurityRule(GetSecurityRuleArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure-native:network:getSecurityRule
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

NetworkSecurityGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the network security group.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group.
SecurityRuleName
This property is required.
Changes to this property will trigger replacement.
string
The name of the security rule.
NetworkSecurityGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the network security group.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group.
SecurityRuleName
This property is required.
Changes to this property will trigger replacement.
string
The name of the security rule.
networkSecurityGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the network security group.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group.
securityRuleName
This property is required.
Changes to this property will trigger replacement.
String
The name of the security rule.
networkSecurityGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the network security group.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group.
securityRuleName
This property is required.
Changes to this property will trigger replacement.
string
The name of the security rule.
network_security_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the network security group.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group.
security_rule_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the security rule.
networkSecurityGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the network security group.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group.
securityRuleName
This property is required.
Changes to this property will trigger replacement.
String
The name of the security rule.

getSecurityRule Result

The following output properties are available:

Access string
The network traffic is allowed or denied.
AzureApiVersion string
The Azure API version of the resource.
Direction string
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
Etag string
A unique read-only string that changes whenever the resource is updated.
Priority 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.
Protocol string
Network protocol this rule applies to.
ProvisioningState string
The provisioning state of the security rule resource.
Description string
A description for this rule. Restricted to 140 chars.
DestinationAddressPrefix string
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.
DestinationAddressPrefixes List<string>
The destination address prefixes. CIDR or destination IP ranges.
DestinationApplicationSecurityGroups List<Pulumi.AzureNative.Network.Outputs.ApplicationSecurityGroupResponse>
The application security group specified as destination.
DestinationPortRange string
The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
DestinationPortRanges List<string>
The destination port ranges.
Id string
Resource ID.
Name string
The name of the resource that is unique within a resource group. This name can be used to access the resource.
SourceAddressPrefix string
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.
SourceAddressPrefixes List<string>
The CIDR or source IP ranges.
SourceApplicationSecurityGroups List<Pulumi.AzureNative.Network.Outputs.ApplicationSecurityGroupResponse>
The application security group specified as source.
SourcePortRange string
The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
SourcePortRanges List<string>
The source port ranges.
Type string
The type of the resource.
Access string
The network traffic is allowed or denied.
AzureApiVersion string
The Azure API version of the resource.
Direction string
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
Etag string
A unique read-only string that changes whenever the resource is updated.
Priority 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.
Protocol string
Network protocol this rule applies to.
ProvisioningState string
The provisioning state of the security rule resource.
Description string
A description for this rule. Restricted to 140 chars.
DestinationAddressPrefix string
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.
DestinationAddressPrefixes []string
The destination address prefixes. CIDR or destination IP ranges.
DestinationApplicationSecurityGroups []ApplicationSecurityGroupResponse
The application security group specified as destination.
DestinationPortRange string
The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
DestinationPortRanges []string
The destination port ranges.
Id string
Resource ID.
Name string
The name of the resource that is unique within a resource group. This name can be used to access the resource.
SourceAddressPrefix string
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.
SourceAddressPrefixes []string
The CIDR or source IP ranges.
SourceApplicationSecurityGroups []ApplicationSecurityGroupResponse
The application security group specified as source.
SourcePortRange string
The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
SourcePortRanges []string
The source port ranges.
Type string
The type of the resource.
access String
The network traffic is allowed or denied.
azureApiVersion String
The Azure API version of the resource.
direction String
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
etag String
A unique read-only string that changes whenever the resource is updated.
priority Integer
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.
protocol String
Network protocol this rule applies to.
provisioningState String
The provisioning state of the security rule resource.
description String
A description for this rule. Restricted to 140 chars.
destinationAddressPrefix String
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.
destinationAddressPrefixes List<String>
The destination address prefixes. CIDR or destination IP ranges.
destinationApplicationSecurityGroups List<ApplicationSecurityGroupResponse>
The application security group specified as destination.
destinationPortRange String
The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
destinationPortRanges List<String>
The destination port ranges.
id String
Resource ID.
name String
The name of the resource that is unique within a resource group. This name can be used to access the resource.
sourceAddressPrefix String
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.
sourceAddressPrefixes List<String>
The CIDR or source IP ranges.
sourceApplicationSecurityGroups List<ApplicationSecurityGroupResponse>
The application security group specified as source.
sourcePortRange String
The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
sourcePortRanges List<String>
The source port ranges.
type String
The type of the resource.
access string
The network traffic is allowed or denied.
azureApiVersion string
The Azure API version of the resource.
direction string
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
etag string
A unique read-only string that changes whenever the resource is updated.
priority number
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.
protocol string
Network protocol this rule applies to.
provisioningState string
The provisioning state of the security rule resource.
description string
A description for this rule. Restricted to 140 chars.
destinationAddressPrefix string
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.
destinationAddressPrefixes string[]
The destination address prefixes. CIDR or destination IP ranges.
destinationApplicationSecurityGroups ApplicationSecurityGroupResponse[]
The application security group specified as destination.
destinationPortRange string
The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
destinationPortRanges string[]
The destination port ranges.
id string
Resource ID.
name string
The name of the resource that is unique within a resource group. This name can be used to access the resource.
sourceAddressPrefix string
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.
sourceAddressPrefixes string[]
The CIDR or source IP ranges.
sourceApplicationSecurityGroups ApplicationSecurityGroupResponse[]
The application security group specified as source.
sourcePortRange string
The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
sourcePortRanges string[]
The source port ranges.
type string
The type of the resource.
access str
The network traffic is allowed or denied.
azure_api_version str
The Azure API version of the resource.
direction str
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
etag str
A unique read-only string that changes whenever the resource is updated.
priority 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.
protocol str
Network protocol this rule applies to.
provisioning_state str
The provisioning state of the security rule resource.
description str
A description for this rule. Restricted to 140 chars.
destination_address_prefix str
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.
destination_address_prefixes Sequence[str]
The destination address prefixes. CIDR or destination IP ranges.
destination_application_security_groups Sequence[ApplicationSecurityGroupResponse]
The application security group specified as destination.
destination_port_range str
The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
destination_port_ranges Sequence[str]
The destination port ranges.
id str
Resource ID.
name str
The name of the resource that is unique within a resource group. This name can be used to access the resource.
source_address_prefix str
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.
source_address_prefixes Sequence[str]
The CIDR or source IP ranges.
source_application_security_groups Sequence[ApplicationSecurityGroupResponse]
The application security group specified as source.
source_port_range str
The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
source_port_ranges Sequence[str]
The source port ranges.
type str
The type of the resource.
access String
The network traffic is allowed or denied.
azureApiVersion String
The Azure API version of the resource.
direction String
The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
etag String
A unique read-only string that changes whenever the resource is updated.
priority Number
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.
protocol String
Network protocol this rule applies to.
provisioningState String
The provisioning state of the security rule resource.
description String
A description for this rule. Restricted to 140 chars.
destinationAddressPrefix String
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.
destinationAddressPrefixes List<String>
The destination address prefixes. CIDR or destination IP ranges.
destinationApplicationSecurityGroups List<Property Map>
The application security group specified as destination.
destinationPortRange String
The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
destinationPortRanges List<String>
The destination port ranges.
id String
Resource ID.
name String
The name of the resource that is unique within a resource group. This name can be used to access the resource.
sourceAddressPrefix String
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.
sourceAddressPrefixes List<String>
The CIDR or source IP ranges.
sourceApplicationSecurityGroups List<Property Map>
The application security group specified as source.
sourcePortRange String
The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
sourcePortRanges List<String>
The source port ranges.
type String
The type of the resource.

Supporting Types

ApplicationSecurityGroupResponse

Etag This property is required. string
A unique read-only string that changes whenever the resource is updated.
Name This property is required. string
Resource name.
ProvisioningState This property is required. string
The provisioning state of the application security group resource.
ResourceGuid This property is required. string
The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups.
Type This property is required. string
Resource type.
Id string
Resource ID.
Location string
Resource location.
Tags Dictionary<string, string>
Resource tags.
Etag This property is required. string
A unique read-only string that changes whenever the resource is updated.
Name This property is required. string
Resource name.
ProvisioningState This property is required. string
The provisioning state of the application security group resource.
ResourceGuid This property is required. string
The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups.
Type This property is required. string
Resource type.
Id string
Resource ID.
Location string
Resource location.
Tags map[string]string
Resource tags.
etag This property is required. String
A unique read-only string that changes whenever the resource is updated.
name This property is required. String
Resource name.
provisioningState This property is required. String
The provisioning state of the application security group resource.
resourceGuid This property is required. String
The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups.
type This property is required. String
Resource type.
id String
Resource ID.
location String
Resource location.
tags Map<String,String>
Resource tags.
etag This property is required. string
A unique read-only string that changes whenever the resource is updated.
name This property is required. string
Resource name.
provisioningState This property is required. string
The provisioning state of the application security group resource.
resourceGuid This property is required. string
The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups.
type This property is required. string
Resource type.
id string
Resource ID.
location string
Resource location.
tags {[key: string]: string}
Resource tags.
etag This property is required. str
A unique read-only string that changes whenever the resource is updated.
name This property is required. str
Resource name.
provisioning_state This property is required. str
The provisioning state of the application security group resource.
resource_guid This property is required. str
The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups.
type This property is required. str
Resource type.
id str
Resource ID.
location str
Resource location.
tags Mapping[str, str]
Resource tags.
etag This property is required. String
A unique read-only string that changes whenever the resource is updated.
name This property is required. String
Resource name.
provisioningState This property is required. String
The provisioning state of the application security group resource.
resourceGuid This property is required. String
The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups.
type This property is required. String
Resource type.
id String
Resource ID.
location String
Resource location.
tags Map<String>
Resource tags.

Package Details

Repository
Azure Native pulumi/pulumi-azure-native
License
Apache-2.0
This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.2.0 published on Monday, Apr 14, 2025 by Pulumi