Share via


Network Watchers - Check Connectivity

Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck?api-version=2024-05-01

URI Parameters

Name In Required Type Description
networkWatcherName
path True

string

The name of the network watcher resource.

resourceGroupName
path True

string

The name of the network watcher resource group.

subscriptionId
path True

string

The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

api-version
query True

string

Client API version.

Request Body

Name Required Type Description
destination True

ConnectivityDestination

The destination of connection.

source True

ConnectivitySource

The source of the connection.

preferredIPVersion

IPVersion

Preferred IP version of the connection.

protocol

Protocol

Network protocol.

protocolConfiguration

ProtocolConfiguration

Configuration of the protocol.

Responses

Name Type Description
200 OK

ConnectivityInformation

Successful request for checking connectivity.

202 Accepted

ConnectivityInformation

Accepted and the operation will complete asynchronously.

Other Status Codes

ErrorResponse

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Check connectivity

Sample request

POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/connectivityCheck?api-version=2024-05-01

{
  "source": {
    "resourceId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"
  },
  "destination": {
    "address": "192.168.100.4",
    "port": 3389
  },
  "preferredIPVersion": "IPv4"
}

Sample response

{
  "hops": [
    {
      "type": "Source",
      "id": "7dbbe7aa-60ba-4650-831e-63d775d38e9e",
      "address": "10.1.1.4",
      "resourceId": "subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/nic0/ipConfigurations/ipconfig1",
      "nextHopIds": [
        "75c8d819-b208-4584-a311-1aa45ce753f9"
      ],
      "issues": []
    },
    {
      "type": "VirtualNetwork",
      "id": "75c8d819-b208-4584-a311-1aa45ce753f9",
      "address": "192.168.100.4",
      "resourceId": "subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/nic1/ipConfigurations/ipconfig1",
      "nextHopIds": [],
      "issues": []
    }
  ],
  "connectionStatus": "Connected",
  "avgLatencyInMs": 1,
  "minLatencyInMs": 1,
  "maxLatencyInMs": 4,
  "probesSent": 100,
  "probesFailed": 0
}
Location: https:/management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/connectivityCheck?api-version=2024-05-01
{
  "hops": [
    {
      "type": "Source",
      "id": "7dbbe7aa-60ba-4650-831e-63d775d38e9e",
      "address": "10.1.1.4",
      "resourceId": "subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/nic0/ipConfigurations/ipconfig1",
      "nextHopIds": [
        "75c8d819-b208-4584-a311-1aa45ce753f9"
      ],
      "issues": []
    },
    {
      "type": "VirtualNetwork",
      "id": "75c8d819-b208-4584-a311-1aa45ce753f9",
      "address": "192.168.100.4",
      "resourceId": "subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/nic1/ipConfigurations/ipconfig1",
      "nextHopIds": [],
      "issues": []
    }
  ],
  "connectionStatus": "Connected",
  "avgLatencyInMs": 1,
  "minLatencyInMs": 1,
  "maxLatencyInMs": 4,
  "probesSent": 100,
  "probesFailed": 0
}

Definitions

Name Description
ConnectionStatus

The connection status.

ConnectivityDestination

Parameters that define destination of connection.

ConnectivityHop

Information about a hop between the source and the destination.

ConnectivityInformation

Information on the connectivity status.

ConnectivityIssue

Information about an issue encountered in the process of checking for connectivity.

ConnectivityParameters

Parameters that determine how the connectivity check will be performed.

ConnectivitySource

Parameters that define the source of the connection.

ErrorDetails

Common error details representation.

ErrorResponse

The error object.

HopLink

Hop link.

HTTPConfiguration

HTTP configuration of the connectivity check.

HTTPHeader

The HTTP header.

HTTPMethod

HTTP method.

IPVersion

IP address version.

IssueType

The type of issue.

Origin

The origin of the issue.

Protocol

Network protocol.

ProtocolConfiguration

Configuration of the protocol.

Severity

The severity of the issue.

ConnectionStatus

The connection status.

Value Description
Unknown
Connected
Disconnected
Degraded

ConnectivityDestination

Parameters that define destination of connection.

Name Type Description
address

string

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

port

integer (int32)

minimum: 0
maximum: 65535

Port on which check connectivity will be performed.

resourceId

string

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

ConnectivityHop

Information about a hop between the source and the destination.

Name Type Description
address

string

The IP address of the hop.

id

string

The ID of the hop.

issues

ConnectivityIssue[]

List of issues.

links

HopLink[]

List of hop links.

nextHopIds

string[]

List of next hop identifiers.

previousHopIds

string[]

List of previous hop identifiers.

previousLinks

HopLink[]

List of previous hop links.

resourceId

string

The ID of the resource corresponding to this hop.

type

string

The type of the hop.

ConnectivityInformation

Information on the connectivity status.

Name Type Description
avgLatencyInMs

integer (int32)

Average latency in milliseconds.

connectionStatus

ConnectionStatus

The connection status.

hops

ConnectivityHop[]

List of hops between the source and the destination.

maxLatencyInMs

integer (int32)

Maximum latency in milliseconds.

minLatencyInMs

integer (int32)

Minimum latency in milliseconds.

probesFailed

integer (int32)

Number of failed probes.

probesSent

integer (int32)

Total number of probes sent.

ConnectivityIssue

Information about an issue encountered in the process of checking for connectivity.

Name Type Description
context

object[]

Provides additional context on the issue.

origin

Origin

The origin of the issue.

severity

Severity

The severity of the issue.

type

IssueType

The type of issue.

ConnectivityParameters

Parameters that determine how the connectivity check will be performed.

Name Type Description
destination

ConnectivityDestination

The destination of connection.

preferredIPVersion

IPVersion

Preferred IP version of the connection.

protocol

Protocol

Network protocol.

protocolConfiguration

ProtocolConfiguration

Configuration of the protocol.

source

ConnectivitySource

The source of the connection.

ConnectivitySource

Parameters that define the source of the connection.

Name Type Description
port

integer (int32)

minimum: 0
maximum: 65535

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

resourceId

string

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

ErrorDetails

Common error details representation.

Name Type Description
code

string

Error code.

message

string

Error message.

target

string

Error target.

ErrorResponse

The error object.

Name Type Description
error

ErrorDetails

Error
The error details object.

Hop link.

Name Type Description
context

object

Provides additional context on links.

issues

ConnectivityIssue[]

List of issues.

linkType

string

Link type.

nextHopId

string

The ID of the next hop.

properties.roundTripTimeAvg

integer (int64)

minimum: 0
maximum: 4294967295

Average roundtrip time in milliseconds.

properties.roundTripTimeMax

integer (int64)

minimum: 0
maximum: 4294967295

Maximum roundtrip time in milliseconds.

properties.roundTripTimeMin

integer (int64)

minimum: 0
maximum: 4294967295

Minimum roundtrip time in milliseconds.

resourceId

string

Resource ID.

HTTPConfiguration

HTTP configuration of the connectivity check.

Name Type Description
headers

HTTPHeader[]

List of HTTP headers.

method

HTTPMethod

HTTP method.

validStatusCodes

integer[] (int32)

Valid status codes.

HTTPHeader

The HTTP header.

Name Type Description
name

string

The name in HTTP header.

value

string

The value in HTTP header.

HTTPMethod

HTTP method.

Value Description
Get

IPVersion

IP address version.

Value Description
IPv4
IPv6

IssueType

The type of issue.

Value Description
Unknown
AgentStopped
GuestFirewall
DnsResolution
SocketBind
NetworkSecurityRule
UserDefinedRoute
PortThrottled
Platform

Origin

The origin of the issue.

Value Description
Local
Inbound
Outbound

Protocol

Network protocol.

Value Description
Tcp
Http
Https
Icmp

ProtocolConfiguration

Configuration of the protocol.

Name Type Description
HTTPConfiguration

HTTPConfiguration

HTTP configuration of the connectivity check.

Severity

The severity of the issue.

Value Description
Error
Warning