Virtual Network Gateway Args
A common class for general resource information. Uses Azure REST API version 2023-02-01. In version 1.x of the Azure Native provider, it used API version 2020-11-01. Other available API versions: 2019-08-01, 2023-04-01, 2023-05-01, 2023-06-01, 2023-09-01, 2023-11-01, 2024-01-01, 2024-03-01, 2024-05-01.
Example Usage
UpdateVirtualNetworkGateway
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var virtualNetworkGateway = new AzureNative.Network.VirtualNetworkGateway("virtualNetworkGateway", new()
{
ActiveActive = false,
AllowRemoteVnetTraffic = false,
AllowVirtualWanTraffic = false,
BgpSettings = new AzureNative.Network.Inputs.BgpSettingsArgs
{
Asn = 65515,
BgpPeeringAddress = "10.0.1.30",
PeerWeight = 0,
},
CustomRoutes = new AzureNative.Network.Inputs.AddressSpaceArgs
{
AddressPrefixes = new[]
{
"101.168.0.6/32",
},
},
DisableIPSecReplayProtection = false,
EnableBgp = false,
EnableBgpRouteTranslationForNat = false,
EnableDnsForwarding = true,
GatewayType = AzureNative.Network.VirtualNetworkGatewayType.Vpn,
IpConfigurations = new[]
{
new AzureNative.Network.Inputs.VirtualNetworkGatewayIPConfigurationArgs
{
Name = "gwipconfig1",
PrivateIPAllocationMethod = AzureNative.Network.IPAllocationMethod.Dynamic,
PublicIPAddress = new AzureNative.Network.Inputs.SubResourceArgs
{
Id = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip",
},
Subnet = new AzureNative.Network.Inputs.SubResourceArgs
{
Id = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet",
},
},
},
Location = "centralus",
NatRules = new[]
{
new AzureNative.Network.Inputs.VirtualNetworkGatewayNatRuleArgs
{
ExternalMappings = new[]
{
new AzureNative.Network.Inputs.VpnNatRuleMappingArgs
{
AddressSpace = "50.0.0.0/24",
},
},
Id = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1",
InternalMappings = new[]
{
new AzureNative.Network.Inputs.VpnNatRuleMappingArgs
{
AddressSpace = "10.10.0.0/24",
},
},
IpConfigurationId = "",
Mode = AzureNative.Network.VpnNatRuleMode.EgressSnat,
Name = "natRule1",
Type = AzureNative.Network.VpnNatRuleType.Static,
},
new AzureNative.Network.Inputs.VirtualNetworkGatewayNatRuleArgs
{
ExternalMappings = new[]
{
new AzureNative.Network.Inputs.VpnNatRuleMappingArgs
{
AddressSpace = "30.0.0.0/24",
},
},
Id = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2",
InternalMappings = new[]
{
new AzureNative.Network.Inputs.VpnNatRuleMappingArgs
{
AddressSpace = "20.10.0.0/24",
},
},
IpConfigurationId = "",
Mode = AzureNative.Network.VpnNatRuleMode.IngressSnat,
Name = "natRule2",
Type = AzureNative.Network.VpnNatRuleType.Static,
},
},
ResourceGroupName = "rg1",
Sku = new AzureNative.Network.Inputs.VirtualNetworkGatewaySkuArgs
{
Name = AzureNative.Network.VirtualNetworkGatewaySkuName.VpnGw1,
Tier = AzureNative.Network.VirtualNetworkGatewaySkuTier.VpnGw1,
},
VirtualNetworkGatewayName = "vpngw",
VpnClientConfiguration = new AzureNative.Network.Inputs.VpnClientConfigurationArgs
{
RadiusServers = new[]
{
new AzureNative.Network.Inputs.RadiusServerArgs
{
RadiusServerAddress = "10.2.0.0",
RadiusServerScore = 20,
RadiusServerSecret = "radiusServerSecret",
},
},
VpnClientProtocols = new[]
{
AzureNative.Network.VpnClientProtocol.OpenVPN,
},
VpnClientRevokedCertificates = new() { },
VpnClientRootCertificates = new() { },
},
VpnType = AzureNative.Network.VpnType.RouteBased,
});
});
package main
import (
network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := network.NewVirtualNetworkGateway(ctx, "virtualNetworkGateway", &network.VirtualNetworkGatewayArgs{
ActiveActive: pulumi.Bool(false),
AllowRemoteVnetTraffic: pulumi.Bool(false),
AllowVirtualWanTraffic: pulumi.Bool(false),
BgpSettings: &network.BgpSettingsArgs{
Asn: pulumi.Float64(65515),
BgpPeeringAddress: pulumi.String("10.0.1.30"),
PeerWeight: pulumi.Int(0),
},
CustomRoutes: &network.AddressSpaceArgs{
AddressPrefixes: pulumi.StringArray{
pulumi.String("101.168.0.6/32"),
},
},
DisableIPSecReplayProtection: pulumi.Bool(false),
EnableBgp: pulumi.Bool(false),
EnableBgpRouteTranslationForNat: pulumi.Bool(false),
EnableDnsForwarding: pulumi.Bool(true),
GatewayType: pulumi.String(network.VirtualNetworkGatewayTypeVpn),
IpConfigurations: network.VirtualNetworkGatewayIPConfigurationArray{
&network.VirtualNetworkGatewayIPConfigurationArgs{
Name: pulumi.String("gwipconfig1"),
PrivateIPAllocationMethod: pulumi.String(network.IPAllocationMethodDynamic),
PublicIPAddress: &network.SubResourceArgs{
Id: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip"),
},
Subnet: &network.SubResourceArgs{
Id: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet"),
},
},
},
Location: pulumi.String("centralus"),
NatRules: network.VirtualNetworkGatewayNatRuleTypeArray{
&network.VirtualNetworkGatewayNatRuleTypeArgs{
ExternalMappings: network.VpnNatRuleMappingArray{
&network.VpnNatRuleMappingArgs{
AddressSpace: pulumi.String("50.0.0.0/24"),
},
},
Id: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1"),
InternalMappings: network.VpnNatRuleMappingArray{
&network.VpnNatRuleMappingArgs{
AddressSpace: pulumi.String("10.10.0.0/24"),
},
},
IpConfigurationId: pulumi.String(""),
Mode: pulumi.String(network.VpnNatRuleModeEgressSnat),
Name: pulumi.String("natRule1"),
Type: pulumi.String(network.VpnNatRuleTypeStatic),
},
&network.VirtualNetworkGatewayNatRuleTypeArgs{
ExternalMappings: network.VpnNatRuleMappingArray{
&network.VpnNatRuleMappingArgs{
AddressSpace: pulumi.String("30.0.0.0/24"),
},
},
Id: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2"),
InternalMappings: network.VpnNatRuleMappingArray{
&network.VpnNatRuleMappingArgs{
AddressSpace: pulumi.String("20.10.0.0/24"),
},
},
IpConfigurationId: pulumi.String(""),
Mode: pulumi.String(network.VpnNatRuleModeIngressSnat),
Name: pulumi.String("natRule2"),
Type: pulumi.String(network.VpnNatRuleTypeStatic),
},
},
ResourceGroupName: pulumi.String("rg1"),
Sku: &network.VirtualNetworkGatewaySkuArgs{
Name: pulumi.String(network.VirtualNetworkGatewaySkuNameVpnGw1),
Tier: pulumi.String(network.VirtualNetworkGatewaySkuTierVpnGw1),
},
VirtualNetworkGatewayName: pulumi.String("vpngw"),
VpnClientConfiguration: &network.VpnClientConfigurationArgs{
RadiusServers: network.RadiusServerArray{
&network.RadiusServerArgs{
RadiusServerAddress: pulumi.String("10.2.0.0"),
RadiusServerScore: pulumi.Float64(20),
RadiusServerSecret: pulumi.String("radiusServerSecret"),
},
},
VpnClientProtocols: pulumi.StringArray{
pulumi.String(network.VpnClientProtocolOpenVPN),
},
VpnClientRevokedCertificates: network.VpnClientRevokedCertificateArray{},
VpnClientRootCertificates: network.VpnClientRootCertificateArray{},
},
VpnType: pulumi.String(network.VpnTypeRouteBased),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.network.VirtualNetworkGateway;
import com.pulumi.azurenative.network.VirtualNetworkGatewayArgs;
import com.pulumi.azurenative.network.inputs.BgpSettingsArgs;
import com.pulumi.azurenative.network.inputs.AddressSpaceArgs;
import com.pulumi.azurenative.network.inputs.VirtualNetworkGatewayIPConfigurationArgs;
import com.pulumi.azurenative.network.inputs.SubResourceArgs;
import com.pulumi.azurenative.network.inputs.VirtualNetworkGatewayNatRuleArgs;
import com.pulumi.azurenative.network.inputs.VirtualNetworkGatewaySkuArgs;
import com.pulumi.azurenative.network.inputs.VpnClientConfigurationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var virtualNetworkGateway = new VirtualNetworkGateway("virtualNetworkGateway", VirtualNetworkGatewayArgs.builder()
.activeActive(false)
.allowRemoteVnetTraffic(false)
.allowVirtualWanTraffic(false)
.bgpSettings(BgpSettingsArgs.builder()
.asn(65515)
.bgpPeeringAddress("10.0.1.30")
.peerWeight(0)
.build())
.customRoutes(AddressSpaceArgs.builder()
.addressPrefixes("101.168.0.6/32")
.build())
.disableIPSecReplayProtection(false)
.enableBgp(false)
.enableBgpRouteTranslationForNat(false)
.enableDnsForwarding(true)
.gatewayType("Vpn")
.ipConfigurations(VirtualNetworkGatewayIPConfigurationArgs.builder()
.name("gwipconfig1")
.privateIPAllocationMethod("Dynamic")
.publicIPAddress(SubResourceArgs.builder()
.id("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip")
.build())
.subnet(SubResourceArgs.builder()
.id("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet")
.build())
.build())
.location("centralus")
.natRules(
VirtualNetworkGatewayNatRuleArgs.builder()
.externalMappings(VpnNatRuleMappingArgs.builder()
.addressSpace("50.0.0.0/24")
.build())
.id("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1")
.internalMappings(VpnNatRuleMappingArgs.builder()
.addressSpace("10.10.0.0/24")
.build())
.ipConfigurationId("")
.mode("EgressSnat")
.name("natRule1")
.type("Static")
.build(),
VirtualNetworkGatewayNatRuleArgs.builder()
.externalMappings(VpnNatRuleMappingArgs.builder()
.addressSpace("30.0.0.0/24")
.build())
.id("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2")
.internalMappings(VpnNatRuleMappingArgs.builder()
.addressSpace("20.10.0.0/24")
.build())
.ipConfigurationId("")
.mode("IngressSnat")
.name("natRule2")
.type("Static")
.build())
.resourceGroupName("rg1")
.sku(VirtualNetworkGatewaySkuArgs.builder()
.name("VpnGw1")
.tier("VpnGw1")
.build())
.virtualNetworkGatewayName("vpngw")
.vpnClientConfiguration(VpnClientConfigurationArgs.builder()
.radiusServers(RadiusServerArgs.builder()
.radiusServerAddress("10.2.0.0")
.radiusServerScore(20)
.radiusServerSecret("radiusServerSecret")
.build())
.vpnClientProtocols("OpenVPN")
.vpnClientRevokedCertificates()
.vpnClientRootCertificates()
.build())
.vpnType("RouteBased")
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:network:VirtualNetworkGateway vpngw /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}
Constructors
Properties
ActiveActive flag.
Property to indicate if the Express Route Gateway serves traffic when there are multiple Express Route Gateways in the vnet
Configure this gateway to accept traffic from other Azure Virtual Networks. This configuration does not support connectivity to Azure Virtual WAN.
Configures this gateway to accept traffic from remote Virtual WAN networks.
Virtual network gateway's BGP speaker settings.
The reference to the address space resource which represents the custom routes address space specified by the customer for virtual network gateway and VpnClient.
disableIPSecReplayProtection flag.
EnableBgpRouteTranslationForNat flag.
Whether dns forwarding is enabled or not.
Whether private IP needs to be enabled on this gateway for connections or not.
The extended location of type local virtual network gateway.
The reference to the LocalNetworkGateway resource which represents local network site having default routes. Assign Null value in case of removing existing default site setting.
The type of this virtual network gateway.
IP configurations for virtual network gateway.
NatRules for virtual network gateway. These are also available as standalone resources. Do not mix inline and standalone resource as they will conflict with each other, leading to resources deletion.
The name of the resource group.
The reference to the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtual network gateway.
The name of the virtual network gateway.
The reference to the VirtualNetworkGatewayPolicyGroup resource which represents the available VirtualNetworkGatewayPolicyGroup for the gateway.
Customer vnet resource id. VirtualNetworkGateway of type local gateway is associated with the customer vnet.
The reference to the VpnClientConfiguration resource which represents the P2S VpnClient configurations.
The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN.