summary import { ConnectivityParameters , NetworkManagementClient } from "@msinternal/network-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function checkConnectivity ( ) { const subscriptionId = "subid" ; const resourceGroupName = "rg1" ; const networkWatcherName = "nw1" ; const parameters = { destination : { address : "192.168.100.4" , port : 3389 } , preferredIPVersion : "IPv4" , source : { resourceId : "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1" } } ; const credential = new DefaultAzureCredential ( ) ; const client = new NetworkManagementClient ( credential , subscriptionId ) ; const result = await client . networkWatchers . beginCheckConnectivityAndWait ( resourceGroupName , networkWatcherName , parameters ) ; console . log ( result ) ; } checkConnectivity ( ) . catch ( console . error ) ;