summary import { VpnGateway , NetworkManagementClient } from "@msinternal/network-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function vpnGatewayPut ( ) { const subscriptionId = "subid" ; const resourceGroupName = "rg1" ; const gatewayName = "gateway1" ; const vpnGatewayParameters = { bgpSettings : { asn : 65515 , bgpPeeringAddresses : [ { customBgpIpAddresses : [ "169.254.21.5" ] , ipconfigurationId : "Instance0" } , { customBgpIpAddresses : [ "169.254.21.10" ] , ipconfigurationId : "Instance1" } ] , peerWeight : 0 } , connections : [ { name : "vpnConnection1" , remoteVpnSite : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1" } , vpnLinkConnections : [ { name : "Connection-Link1" , connectionBandwidth : 200 , egressNatRules : [ { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03" } ] , sharedKey : "key" , vpnConnectionProtocolType : "IKEv2" , vpnSiteLink : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1" } } ] } ] , enableBgpRouteTranslationForNat : false , isRoutingPreferenceInternet : false , location : "westcentralus" , natRules : [ { name : "nat03" , typePropertiesType : "Static" , externalMappings : [ { addressSpace : "192.168.0.0/26" } ] , internalMappings : [ { addressSpace : "0.0.0.0/26" } ] , ipConfigurationId : "" , mode : "EgressSnat" } ] , tags : { key1 : "value1" } , virtualHub : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1" } } ; const credential = new DefaultAzureCredential ( ) ; const client = new NetworkManagementClient ( credential , subscriptionId ) ; const result = await client . vpnGateways . beginCreateOrUpdateAndWait ( resourceGroupName , gatewayName , vpnGatewayParameters ) ; console . log ( result ) ; } vpnGatewayPut ( ) . catch ( console . error ) ;