summary import { VpnConnectionPacketCaptureStartParameters , NetworkManagementClient } from "@msinternal/network-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function startPacketCaptureOnVpnConnectionWithFilter ( ) { const subscriptionId = "subid" ; const resourceGroupName = "rg1" ; const gatewayName = "gateway1" ; const vpnConnectionName = "vpnConnection1" ; const parameters = { filterData : "{'TracingFlags': 11,'MaxPacketBufferSize': 120,'MaxFileSize': 200,'Filters': [{'SourceSubnets': ['20.1.1.0/24'],'DestinationSubnets': ['10.1.1.0/24'],'SourcePort': [500],'DestinationPort': [4500],'Protocol': 6,'TcpFlags': 16,'CaptureSingleDirectionTrafficOnly': true}]}" , linkConnectionNames : [ "siteLink1" , "siteLink2" ] } ; const options = { parameters : parameters } ; const credential = new DefaultAzureCredential ( ) ; const client = new NetworkManagementClient ( credential , subscriptionId ) ; const result = await client . vpnConnections . beginStartPacketCaptureAndWait ( resourceGroupName , gatewayName , vpnConnectionName , options ) ; console . log ( result ) ; } startPacketCaptureOnVpnConnectionWithFilter ( ) . catch ( console . error ) ;