Network Watchers - Get Next Hop

Gets the next hop from the specified VM.

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

URI Parameters

Name In Required Type Description
networkWatcherName
path True

string

The name of the network watcher.

resourceGroupName
path True

string

The name of the 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
destinationIPAddress True

string

The destination IP address.

sourceIPAddress True

string

The source IP address.

targetResourceId True

string

The resource identifier of the target resource against which the action is to be performed.

targetNicResourceId

string

The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of the nics, then this parameter must be specified. Otherwise optional).

Responses

Name Type Description
200 OK

NextHopResult

Request successful. The operation returns the next hop from the VM.

202 Accepted

NextHopResult

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

Get next hop

Sample Request

POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/nextHop?api-version=2023-09-01

{
  "targetResourceId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1",
  "sourceIPAddress": "10.0.0.5",
  "destinationIPAddress": "10.0.0.10",
  "targetNicResourceId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/nic1"
}

Sample Response

{
  "nextHopType": "VnetLocal",
  "nextHopIpAddress": "10.0.0.1",
  "routeTableId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/routeTables/rt1"
}
Location: https:/management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/nextHop?api-version=2023-09-01
{
  "nextHopType": "VnetLocal",
  "nextHopIpAddress": "10.0.0.1",
  "routeTableId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/routeTables/rt1"
}

Definitions

Name Description
ErrorDetails

Common error details representation.

ErrorResponse

The error object.

NextHopParameters

Parameters that define the source and destination endpoint.

NextHopResult

The information about next hop from the specified VM.

NextHopType

Next hop type.

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.

NextHopParameters

Parameters that define the source and destination endpoint.

Name Type Description
destinationIPAddress

string

The destination IP address.

sourceIPAddress

string

The source IP address.

targetNicResourceId

string

The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of the nics, then this parameter must be specified. Otherwise optional).

targetResourceId

string

The resource identifier of the target resource against which the action is to be performed.

NextHopResult

The information about next hop from the specified VM.

Name Type Description
nextHopIpAddress

string

Next hop IP Address.

nextHopType

NextHopType

Next hop type.

routeTableId

string

The resource identifier for the route table associated with the route being returned. If the route being returned does not correspond to any user created routes then this field will be the string 'System Route'.

NextHopType

Next hop type.

Name Type Description
HyperNetGateway

string

Internet

string

None

string

VirtualAppliance

string

VirtualNetworkGateway

string

VnetLocal

string