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=2023-09-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
network
|
path | True |
string |
The name of the network watcher resource. |
resource
|
path | True |
string |
The name of the network watcher resource group. |
subscription
|
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 |
The destination of connection. |
|
source | True |
The source of the connection. |
|
preferredIPVersion |
Preferred IP version of the connection. |
||
protocol |
Network protocol. |
||
protocolConfiguration |
Configuration of the protocol. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
Successful request for checking connectivity. |
|
202 Accepted |
Accepted and the operation will complete asynchronously. |
|
Other Status Codes |
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=2023-09-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=2023-09-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 |
---|---|
Connection |
The connection status. |
Connectivity |
Parameters that define destination of connection. |
Connectivity |
Information about a hop between the source and the destination. |
Connectivity |
Information on the connectivity status. |
Connectivity |
Information about an issue encountered in the process of checking for connectivity. |
Connectivity |
Parameters that determine how the connectivity check will be performed. |
Connectivity |
Parameters that define the source of the connection. |
Error |
Common error details representation. |
Error |
The error object. |
Hop |
Hop link. |
HTTPConfiguration |
HTTP configuration of the connectivity check. |
HTTPHeader |
The HTTP header. |
HTTPMethod |
HTTP method. |
IPVersion |
IP address version. |
Issue |
The type of issue. |
Origin |
The origin of the issue. |
Protocol |
Network protocol. |
Protocol |
Configuration of the protocol. |
Severity |
The severity of the issue. |
ConnectionStatus
The connection status.
Name | Type | Description |
---|---|---|
Connected |
string |
|
Degraded |
string |
|
Disconnected |
string |
|
Unknown |
string |
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 |
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 |
List of issues. |
|
links |
Hop |
List of hop links. |
nextHopIds |
string[] |
List of next hop identifiers. |
previousHopIds |
string[] |
List of previous hop identifiers. |
previousLinks |
Hop |
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 |
Average latency in milliseconds. |
connectionStatus |
The connection status. |
|
hops |
List of hops between the source and the destination. |
|
maxLatencyInMs |
integer |
Maximum latency in milliseconds. |
minLatencyInMs |
integer |
Minimum latency in milliseconds. |
probesFailed |
integer |
Number of failed probes. |
probesSent |
integer |
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 |
The origin of the issue. |
|
severity |
The severity of the issue. |
|
type |
The type of issue. |
ConnectivityParameters
Parameters that determine how the connectivity check will be performed.
Name | Type | Description |
---|---|---|
destination |
The destination of connection. |
|
preferredIPVersion |
Preferred IP version of the connection. |
|
protocol |
Network protocol. |
|
protocolConfiguration |
Configuration of the protocol. |
|
source |
The source of the connection. |
ConnectivitySource
Parameters that define the source of the connection.
Name | Type | Description |
---|---|---|
port |
integer |
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 |
Error |
HopLink
Hop link.
Name | Type | Description |
---|---|---|
context |
object |
Provides additional context on links. |
issues |
List of issues. |
|
linkType |
string |
Link type. |
nextHopId |
string |
The ID of the next hop. |
properties.roundTripTimeAvg |
integer |
Average roundtrip time in milliseconds. |
properties.roundTripTimeMax |
integer |
Maximum roundtrip time in milliseconds. |
properties.roundTripTimeMin |
integer |
Minimum roundtrip time in milliseconds. |
resourceId |
string |
Resource ID. |
HTTPConfiguration
HTTP configuration of the connectivity check.
Name | Type | Description |
---|---|---|
headers |
List of HTTP headers. |
|
method |
HTTP method. |
|
validStatusCodes |
integer[] |
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.
Name | Type | Description |
---|---|---|
Get |
string |
IPVersion
IP address version.
Name | Type | Description |
---|---|---|
IPv4 |
string |
|
IPv6 |
string |
IssueType
The type of issue.
Name | Type | Description |
---|---|---|
AgentStopped |
string |
|
DnsResolution |
string |
|
GuestFirewall |
string |
|
NetworkSecurityRule |
string |
|
Platform |
string |
|
PortThrottled |
string |
|
SocketBind |
string |
|
Unknown |
string |
|
UserDefinedRoute |
string |
Origin
The origin of the issue.
Name | Type | Description |
---|---|---|
Inbound |
string |
|
Local |
string |
|
Outbound |
string |
Protocol
Network protocol.
Name | Type | Description |
---|---|---|
Http |
string |
|
Https |
string |
|
Icmp |
string |
|
Tcp |
string |
ProtocolConfiguration
Configuration of the protocol.
Name | Type | Description |
---|---|---|
HTTPConfiguration |
HTTP configuration of the connectivity check. |
Severity
The severity of the issue.
Name | Type | Description |
---|---|---|
Error |
string |
|
Warning |
string |