summary import { VirtualRouter , NetworkManagementClient } from "@msinternal/network-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function createVirtualRouter ( ) { const subscriptionId = "subid" ; const resourceGroupName = "rg1" ; const virtualRouterName = "virtualRouter" ; const parameters = { hostedGateway : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vnetGateway" } , location : "West US" , tags : { key1 : "value1" } } ; const credential = new DefaultAzureCredential ( ) ; const client = new NetworkManagementClient ( credential , subscriptionId ) ; const result = await client . virtualRouters . beginCreateOrUpdateAndWait ( resourceGroupName , virtualRouterName , parameters ) ; console . log ( result ) ; } createVirtualRouter ( ) . catch ( console . error ) ;