Edit

Share via


Get-AzNetworkWatcherSecurityGroupView

View the configured and effective network security group rules applied on a VM.

Syntax

SetByResource (Default)

Get-AzNetworkWatcherSecurityGroupView
    -NetworkWatcher <PSNetworkWatcher>
    -TargetVirtualMachineId <String>
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

SetByName

Get-AzNetworkWatcherSecurityGroupView
    -NetworkWatcherName <String>
    -ResourceGroupName <String>
    -TargetVirtualMachineId <String>
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

SetByLocation

Get-AzNetworkWatcherSecurityGroupView
    -Location <String>
    -TargetVirtualMachineId <String>
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Get-AzNetworkWatcherSecurityGroupView enables you to view the configured and effective network security group rules applied on a VM.

Examples

Example 1: Make a Security Group View call on a VM

$nw = Get-AzResource | Where-Object {$_.ResourceType -eq "Microsoft.Network/networkWatchers" -and $_.Location -eq "WestCentralUS" }
$networkWatcher = Get-AzNetworkWatcher -Name $nw.Name -ResourceGroupName $nw.ResourceGroupName
$VM = Get-AzVM -ResourceGroupName ContosoResourceGroup -Name VM0
Get-AzNetworkWatcherSecurityGroupView -NetworkWatcher $networkWatcher -TargetVirtualMachineId $VM.Id

In the above example, we first get the regional Network Watcher, then a VM in the region. Then we make a Security Group View call on the specified VM.

Parameters

-AsJob

Run cmdlet in the background

Parameter properties

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

Parameter sets

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

-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:AzContext, 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

-Location

Location of the network watcher.

Parameter properties

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

Parameter sets

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

-NetworkWatcher

The network watcher resource.

Parameter properties

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

Parameter sets

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

-NetworkWatcherName

The name of network watcher.

Parameter properties

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

Parameter sets

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

-ResourceGroupName

The name of the network watcher resource group.

Parameter properties

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

Parameter sets

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

-TargetVirtualMachineId

The target VM Id

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:True
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.

Inputs

PSNetworkWatcher

String

Outputs

PSSecurityGroupViewResult

Notes

Keywords: azure, azurerm, arm, resource, management, manager, network, networking, network watcher, flow, ip