Test-AzureRmNetworkWatcherConnectivity

Returns connectivity information for a specified source VM and a destination.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

Test-AzureRmNetworkWatcherConnectivity
    -NetworkWatcher <PSNetworkWatcher>
    -SourceId <String>
    [-SourcePort <Int32>]
    [-DestinationId <String>]
    [-DestinationAddress <String>]
    [-DestinationPort <Int32>]
    [-ProtocolConfiguration <PSNetworkWatcherProtocolConfiguration>]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Test-AzureRmNetworkWatcherConnectivity
    -NetworkWatcherName <String>
    -ResourceGroupName <String>
    -SourceId <String>
    [-SourcePort <Int32>]
    [-DestinationId <String>]
    [-DestinationAddress <String>]
    [-DestinationPort <Int32>]
    [-ProtocolConfiguration <PSNetworkWatcherProtocolConfiguration>]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Test-AzureRmNetworkWatcherConnectivity
    -Location <String>
    -SourceId <String>
    [-SourcePort <Int32>]
    [-DestinationId <String>]
    [-DestinationAddress <String>]
    [-DestinationPort <Int32>]
    [-ProtocolConfiguration <PSNetworkWatcherProtocolConfiguration>]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Test-AzureRmNetworkWatcherConnectivity cmdlet returns connectivity information for a specified source VM and a destination. If connectivity between the source and destination cannot be established, the cmdlet returns details about the issue.

Examples

Example 1: Test Network Watcher Connectivity from a VM to a website

Test-AzureRmNetworkWatcherConnectivity -NetworkWatcherName NetworkWatcher -ResourceGroupName NetworkWatcherRG -SourceId "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ContosoRG/providers/Microsoft.Compute/virtualMachines/MultiTierApp0" -DestinationAddress "bing.com" -DestinationPort 80


ConnectionStatus : Reachable
AvgLatencyInMs   : 4
MinLatencyInMs   : 2
MaxLatencyInMs   : 15
ProbesSent       : 15
ProbesFailed     : 0
Hops             : [
                     {
                       "Type": "Source",
                       "Id": "f8cff464-e13f-457f-a09e-4dcd53d38a85",
                       "Address": "10.1.1.4",
                       "ResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ContosoRG/provi                   iders/Microsoft.Network/networkInterfaces/appNic0/ipConfigurations/ipconfig1",
                       "NextHopIds": [
                         "1034b1bf-0b1b-4f0a-93b2-900477f45485"
                       ],
                       "Issues": []
                     },
                     {
                       "Type": "Internet",
                       "Id": "1034b1bf-0b1b-4f0a-93b2-900477f45485",
                       "Address": "13.107.21.200",
                       "ResourceId": "Internet",
                       "NextHopIds": [],
                       "Issues": []
                     }
                   ]

In this example we test connectivity from a VM in Azure to www.bing.com.

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:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DestinationAddress

The IP address or URI the resource to which a connection attempt will be made.

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

-DestinationId

The ID of the resource to which a connection attempt will be made.

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

-DestinationPort

Port on which check connectivity will be performed.

Type:Int32
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

-ProtocolConfiguration

Protocal configuration on which check connectivity will be performed.

Type:PSNetworkWatcherProtocolConfiguration
Position:Named
Default value:None
Required:False
Accept pipeline input:False
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

-SourceId

The ID of the resource from which a connectivity check will be initiated.

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

-SourcePort

The source port from which a connectivity check will be performed.

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

Inputs

PSNetworkWatcher

Parameters: NetworkWatcher (ByValue)

String

Int32

Outputs

PSConnectivityInformation

Notes

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