GetNetworkSecurityGroup

Use this data source to access information about an existing Network Security Group.

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(Azure.Network.GetNetworkSecurityGroup.InvokeAsync(new Azure.Network.GetNetworkSecurityGroupArgs
        {
            Name = azurerm_network_security_group.Example.Name,
            ResourceGroupName = azurerm_resource_group.Example.Name,
        }));
        this.Location = example.Apply(example => example.Location);
    }

    [Output("location")]
    public Output<string> Location { get; set; }
}
package main

import (
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/network"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        example, err := network.LookupNetworkSecurityGroup(ctx, &network.LookupNetworkSecurityGroupArgs{
            Name:              azurerm_network_security_group.Example.Name,
            ResourceGroupName: azurerm_resource_group.Example.Name,
        }, nil)
        if err != nil {
            return err
        }
        ctx.Export("location", example.Location)
        return nil
    })
}
import pulumi
import pulumi_azure as azure

example = azure.network.get_network_security_group(name=azurerm_network_security_group["example"]["name"],
    resource_group_name=azurerm_resource_group["example"]["name"])
pulumi.export("location", example.location)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.network.getNetworkSecurityGroup({
    name: azurerm_network_security_group.example.name,
    resourceGroupName: azurerm_resource_group.example.name,
});
export const location = example.then(example => example.location);

Using GetNetworkSecurityGroup

function getNetworkSecurityGroup(args: GetNetworkSecurityGroupArgs, opts?: InvokeOptions): Promise<GetNetworkSecurityGroupResult>
function  get_network_security_group(name=None, resource_group_name=None, opts=None)
func LookupNetworkSecurityGroup(ctx *Context, args *LookupNetworkSecurityGroupArgs, opts ...InvokeOption) (*LookupNetworkSecurityGroupResult, error)

Note: This function is named LookupNetworkSecurityGroup in the Go SDK.

public static class GetNetworkSecurityGroup {
    public static Task<GetNetworkSecurityGroupResult> InvokeAsync(GetNetworkSecurityGroupArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string

Specifies the Name of the Network Security Group.

ResourceGroupName string

Specifies the Name of the Resource Group within which the Network Security Group exists

Name string

Specifies the Name of the Network Security Group.

ResourceGroupName string

Specifies the Name of the Resource Group within which the Network Security Group exists

name string

Specifies the Name of the Network Security Group.

resourceGroupName string

Specifies the Name of the Resource Group within which the Network Security Group exists

name str

Specifies the Name of the Network Security Group.

resource_group_name str

Specifies the Name of the Resource Group within which the Network Security Group exists

GetNetworkSecurityGroup Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Location string

The supported Azure location where the resource exists.

Name string

The name of the security rule.

ResourceGroupName string
SecurityRules List<GetNetworkSecurityGroupSecurityRule>

One or more security_rule blocks as defined below.

Tags Dictionary<string, string>

A mapping of tags assigned to the resource.

Id string

The provider-assigned unique ID for this managed resource.

Location string

The supported Azure location where the resource exists.

Name string

The name of the security rule.

ResourceGroupName string
SecurityRules []GetNetworkSecurityGroupSecurityRule

One or more security_rule blocks as defined below.

Tags map[string]string

A mapping of tags assigned to the resource.

id string

The provider-assigned unique ID for this managed resource.

location string

The supported Azure location where the resource exists.

name string

The name of the security rule.

resourceGroupName string
securityRules GetNetworkSecurityGroupSecurityRule[]

One or more security_rule blocks as defined below.

tags {[key: string]: string}

A mapping of tags assigned to the resource.

id str

The provider-assigned unique ID for this managed resource.

location str

The supported Azure location where the resource exists.

name str

The name of the security rule.

resource_group_name str
security_rules List[GetNetworkSecurityGroupSecurityRule]

One or more security_rule blocks as defined below.

tags Dict[str, str]

A mapping of tags assigned to the resource.

Supporting Types

GetNetworkSecurityGroupSecurityRule

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Access string

Is network traffic is allowed or denied?

Description string

The description for this rule.

DestinationAddressPrefix string

CIDR or destination IP range or * to match any IP.

DestinationAddressPrefixes List<string>

A list of CIDRs or destination IP ranges.

DestinationPortRange string

The Destination Port or Range.

DestinationPortRanges List<string>
Direction string

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

Name string

Specifies the Name of the Network Security Group.

Priority int

The priority of the rule

Protocol string

The network protocol this rule applies to.

SourceAddressPrefix string

CIDR or source IP range or * to match any IP.

SourceAddressPrefixes List<string>

A list of CIDRs or source IP ranges.

SourcePortRange string

The Source Port or Range.

SourcePortRanges List<string>
DestinationApplicationSecurityGroupIds List<string>

A List of destination Application Security Group ID’s

SourceApplicationSecurityGroupIds List<string>

A List of source Application Security Group ID’s

Access string

Is network traffic is allowed or denied?

Description string

The description for this rule.

DestinationAddressPrefix string

CIDR or destination IP range or * to match any IP.

DestinationAddressPrefixes []string

A list of CIDRs or destination IP ranges.

DestinationPortRange string

The Destination Port or Range.

DestinationPortRanges []string
Direction string

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

Name string

Specifies the Name of the Network Security Group.

Priority int

The priority of the rule

Protocol string

The network protocol this rule applies to.

SourceAddressPrefix string

CIDR or source IP range or * to match any IP.

SourceAddressPrefixes []string

A list of CIDRs or source IP ranges.

SourcePortRange string

The Source Port or Range.

SourcePortRanges []string
DestinationApplicationSecurityGroupIds []string

A List of destination Application Security Group ID’s

SourceApplicationSecurityGroupIds []string

A List of source Application Security Group ID’s

access string

Is network traffic is allowed or denied?

description string

The description for this rule.

destinationAddressPrefix string

CIDR or destination IP range or * to match any IP.

destinationAddressPrefixes string[]

A list of CIDRs or destination IP ranges.

destinationPortRange string

The Destination Port or Range.

destinationPortRanges string[]
direction string

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

name string

Specifies the Name of the Network Security Group.

priority number

The priority of the rule

protocol string

The network protocol this rule applies to.

sourceAddressPrefix string

CIDR or source IP range or * to match any IP.

sourceAddressPrefixes string[]

A list of CIDRs or source IP ranges.

sourcePortRange string

The Source Port or Range.

sourcePortRanges string[]
destinationApplicationSecurityGroupIds string[]

A List of destination Application Security Group ID’s

sourceApplicationSecurityGroupIds string[]

A List of source Application Security Group ID’s

access str

Is network traffic is allowed or denied?

description str

The description for this rule.

destination_address_prefix str

CIDR or destination IP range or * to match any IP.

destination_address_prefixes List[str]

A list of CIDRs or destination IP ranges.

destination_port_range str

The Destination Port or Range.

destination_port_ranges List[str]
direction str

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

name str

Specifies the Name of the Network Security Group.

priority float

The priority of the rule

protocol str

The network protocol this rule applies to.

source_address_prefix str

CIDR or source IP range or * to match any IP.

source_address_prefixes List[str]

A list of CIDRs or source IP ranges.

source_port_range str

The Source Port or Range.

source_port_ranges List[str]
destination_application_security_group_ids List[str]

A List of destination Application Security Group ID’s

source_application_security_group_ids List[str]

A List of source Application Security Group ID’s

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.