Edit

Share via


Get-AzNetworkSecurityGroup

Gets a network security group.

Syntax

NoExpand

Get-AzNetworkSecurityGroup
    [-Name <String>]
    [-ResourceGroupName <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Expand

Get-AzNetworkSecurityGroup
    -Name <String>
    -ResourceGroupName <String>
    -ExpandResource <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Get-AzNetworkSecurityGroup cmdlet gets an Azure network security group.

Examples

1: Retrieve an existing network security group

Get-AzNetworkSecurityGroup -Name  nsg1 -ResourceGroupName "rg1"

This command returns contents of Azure network security group "nsg1" in resource group "rg1"

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExpandResource

The Get-AzNetworkSecurityGroup cmdlet gets an Azure network security group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Expand
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

Specifies the name of the network security group that this cmdlet gets.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ResourceName

Parameter sets

NoExpand
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroupName

Specifies the name of the resource group that the network security group belongs to.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

NoExpand
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

PSNetworkSecurityGroup