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
LookupNetworkSecurityGroupin 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.
- Resource
Group stringName Specifies the Name of the Resource Group within which the Network Security Group exists
- Name string
Specifies the Name of the Network Security Group.
- Resource
Group stringName Specifies the Name of the Resource Group within which the Network Security Group exists
- name string
Specifies the Name of the Network Security Group.
- resource
Group stringName 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_ strname 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.
- Resource
Group stringName - Security
Rules List<GetNetwork Security Group Security Rule> One or more
security_ruleblocks as defined below.- 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.
- Resource
Group stringName - Security
Rules []GetNetwork Security Group Security Rule One or more
security_ruleblocks as defined below.- 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.
- resource
Group stringName - security
Rules GetNetwork Security Group Security Rule[] One or more
security_ruleblocks as defined below.- {[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_ strname - security_
rules List[GetNetwork Security Group Security Rule] One or more
security_ruleblocks as defined below.- 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.
- Destination
Address stringPrefix CIDR or destination IP range or * to match any IP.
- Destination
Address List<string>Prefixes A list of CIDRs or destination IP ranges.
- Destination
Port stringRange The Destination Port or Range.
- Destination
Port List<string>Ranges - 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.
- Source
Address stringPrefix CIDR or source IP range or * to match any IP.
- Source
Address List<string>Prefixes A list of CIDRs or source IP ranges.
- Source
Port stringRange The Source Port or Range.
- Source
Port List<string>Ranges - Destination
Application List<string>Security Group Ids A List of destination Application Security Group ID’s
- Source
Application List<string>Security Group Ids 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.
- Destination
Address stringPrefix CIDR or destination IP range or * to match any IP.
- Destination
Address []stringPrefixes A list of CIDRs or destination IP ranges.
- Destination
Port stringRange The Destination Port or Range.
- Destination
Port []stringRanges - 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.
- Source
Address stringPrefix CIDR or source IP range or * to match any IP.
- Source
Address []stringPrefixes A list of CIDRs or source IP ranges.
- Source
Port stringRange The Source Port or Range.
- Source
Port []stringRanges - Destination
Application []stringSecurity Group Ids A List of destination Application Security Group ID’s
- Source
Application []stringSecurity Group Ids 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.
- destination
Address stringPrefix CIDR or destination IP range or * to match any IP.
- destination
Address string[]Prefixes A list of CIDRs or destination IP ranges.
- destination
Port stringRange The Destination Port or Range.
- destination
Port string[]Ranges - 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.
- source
Address stringPrefix CIDR or source IP range or * to match any IP.
- source
Address string[]Prefixes A list of CIDRs or source IP ranges.
- source
Port stringRange The Source Port or Range.
- source
Port string[]Ranges - destination
Application string[]Security Group Ids A List of destination Application Security Group ID’s
- source
Application string[]Security Group Ids 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_ strprefix CIDR or destination IP range or * to match any IP.
- destination_
address_ List[str]prefixes A list of CIDRs or destination IP ranges.
- destination_
port_ strrange The Destination Port or Range.
- destination_
port_ List[str]ranges - 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_ strprefix CIDR or source IP range or * to match any IP.
- source_
address_ List[str]prefixes A list of CIDRs or source IP ranges.
- source_
port_ strrange The Source Port or Range.
- source_
port_ List[str]ranges - destination_
application_ List[str]security_ group_ ids A List of destination Application Security Group ID’s
- source_
application_ List[str]security_ group_ ids 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
azurermTerraform Provider.