Upravit

Sdílet prostřednictvím


Get-AzNetworkWatcherSecurityGroupView

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

Syntax

Get-AzNetworkWatcherSecurityGroupView
   -NetworkWatcher <PSNetworkWatcher>
   -TargetVirtualMachineId <String>
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzNetworkWatcherSecurityGroupView
   -NetworkWatcherName <String>
   -ResourceGroupName <String>
   -TargetVirtualMachineId <String>
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Location

Location of the network watcher.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-NetworkWatcher

The network watcher resource.

Type:PSNetworkWatcher
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-NetworkWatcherName

The name of network watcher.

Type:String
Aliases:Name
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

The name of the network watcher resource group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TargetVirtualMachineId

The target VM Id

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

PSNetworkWatcher

String

Outputs

PSSecurityGroupViewResult

Notes

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