summary import { VirtualNetworkPeering , NetworkManagementClient } from "@msinternal/network-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function createPeeringWithRemoteVirtualNetworkEncryption ( ) { const subscriptionId = "subid" ; const resourceGroupName = "peerTest" ; const virtualNetworkName = "vnet1" ; const virtualNetworkPeeringName = "peer" ; const virtualNetworkPeeringParameters = { allowForwardedTraffic : true , allowGatewayTransit : false , allowVirtualNetworkAccess : true , remoteVirtualNetwork : { id : "/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2" } , useRemoteGateways : false } ; const credential = new DefaultAzureCredential ( ) ; const client = new NetworkManagementClient ( credential , subscriptionId ) ; const result = await client . virtualNetworkPeerings . beginCreateOrUpdateAndWait ( resourceGroupName , virtualNetworkName , virtualNetworkPeeringName , virtualNetworkPeeringParameters ) ; console . log ( result ) ; } createPeeringWithRemoteVirtualNetworkEncryption ( ) . catch ( console . error ) ;