New-AzVirtualNetworkGatewayConnection
Skapar VPN-anslutningen plats-till-plats mellan den virtuella nätverksgatewayen och den lokala VPN-enheten.
Syntax
New-AzVirtualNetworkGatewayConnection
-Name <String>
-ResourceGroupName <String>
-Location <String>
[-AuthorizationKey <String>]
-VirtualNetworkGateway1 <PSVirtualNetworkGateway>
[-VirtualNetworkGateway2 <PSVirtualNetworkGateway>]
[-LocalNetworkGateway2 <PSLocalNetworkGateway>]
-ConnectionType <String>
[-RoutingWeight <Int32>]
[-DpdTimeoutInSeconds <Int32>]
[-ConnectionMode <String>]
[-SharedKey <String>]
[-Peer <PSPeering>]
[-EnableBgp <Boolean>]
[-UseLocalAzureIpAddress]
[-Tag <Hashtable>]
[-Force]
[-UsePolicyBasedTrafficSelectors <Boolean>]
[-IpsecPolicies <PSIpsecPolicy[]>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-ConnectionProtocol <String>]
[-IngressNatRule <PSResourceId[]>]
[-EgressNatRule <PSResourceId[]>]
[-GatewayCustomBgpIpAddress <PSGatewayCustomBgpIpConfiguration[]>]
[-AsJob]
[-ExpressRouteGatewayBypass]
[-EnablePrivateLinkFastPath]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVirtualNetworkGatewayConnection
-Name <String>
-ResourceGroupName <String>
-Location <String>
[-AuthorizationKey <String>]
-VirtualNetworkGateway1 <PSVirtualNetworkGateway>
[-VirtualNetworkGateway2 <PSVirtualNetworkGateway>]
[-LocalNetworkGateway2 <PSLocalNetworkGateway>]
-ConnectionType <String>
[-RoutingWeight <Int32>]
[-DpdTimeoutInSeconds <Int32>]
[-ConnectionMode <String>]
[-SharedKey <String>]
[-PeerId <String>]
[-EnableBgp <Boolean>]
[-UseLocalAzureIpAddress]
[-Tag <Hashtable>]
[-Force]
[-UsePolicyBasedTrafficSelectors <Boolean>]
[-IpsecPolicies <PSIpsecPolicy[]>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-ConnectionProtocol <String>]
[-IngressNatRule <PSResourceId[]>]
[-EgressNatRule <PSResourceId[]>]
[-GatewayCustomBgpIpAddress <PSGatewayCustomBgpIpConfiguration[]>]
[-AsJob]
[-ExpressRouteGatewayBypass]
[-EnablePrivateLinkFastPath]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Skapar VPN-anslutningen plats-till-plats mellan den virtuella nätverksgatewayen och den lokala VPN-enheten.
Exempel
Exempel 1
$vnetgw1 = Get-AzVirtualNetworkGateway -ResourceGroupName "Rg1" -Name "gw1"
$vnetgw2 = Get-AzVirtualNetworkGateway -ResourceGroupName "Rg1" -Name "gw2"
New-AzVirtualNetworkGatewayConnection -Name conn-client-1 -ResourceGroupName "Rg1" -VirtualNetworkGateway1 $vnetgw1 -VirtualNetworkGateway2 $vnetgw2 -Location "eastus" -ConnectionType Vnet2Vnet -SharedKey 'a1b2c3d4e5'
Exempel 2 Lägg till/uppdatera IngressNatRule/EgressNatRule till en befintlig virtuell nätverksgatewayanslutning
$vnetgw1 = Get-AzVirtualNetworkGateway -ResourceGroupName "Rg1" -Name "vnetgw1"
$vnetgw2 = Get-AzVirtualNetworkGateway -ResourceGroupName "Rg1" -Name "vnetgw2"
$ingressnatrule = Get-AzVirtualNetworkGatewayNatRule -ResourceGroupName "Rg1" -Name "natRule1" -ParentResourceName vnetgw1
$egressnatrule = Get-AzVirtualNetworkGatewayNatRule -ResourceGroupName "Rg1" -Name "natRule2" -ParentResourceName vnetgw1
New-AzVirtualNetworkGatewayConnection -Name conn-client-1 -ResourceGroupName $RG1 -VirtualNetworkGateway1 $vnetgw1 -VirtualNetworkGateway2 $vnetgw2 -Location "eastus" -ConnectionType Vnet2Vnet -SharedKey 'a1b2c3d4e5' `
-IngressNatRule $ingressnatrule -EgressNatRule $egressnatrule
Det första kommandot hämtar en natRule för virtuell nätverksgateway med namnet natRule1 som är av typen IngressSnat. Det andra kommandot hämtar en natRule för virtuell nätverksgateway med namnet natRule2 som är av typen EgressSnat. Det tredje kommandot skapar den här nya virtuella nätverksgatewayanslutningen med Ingress och Egress NatRules.
Exempel 3 Lägg till GatewayCustomBgpIpAddress till anslutning till virtuell nätverksgateway
$LocalnetGateway = Get-AzLocalNetworkGateway -ResourceGroupName "PS_testing" -name "testLng"
$gateway = Get-AzVirtualNetworkGateway -ResourceGroupName PS_testing -ResourceName testGw
$address = New-AzGatewayCustomBgpIpConfigurationObject -IpConfigurationId "/subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/virtualNetworkGateways/testGw/ipConfigurations/default" -CustomBgpIpAddress "169.254.21.1"
New-AzVirtualNetworkGatewayConnection -ResourceGroupName "PS_testing" -name "Conn" -location "eastus" -VirtualNetworkGateway1 $gateway -LocalNetworkGateway2 $localnetGateway -ConnectionType IPsec -RoutingWeight 3 -SharedKey abc -GatewayCustomBgpIpAddress $address -EnableBgp $true
De två kommandona hämtar en lokal nätverksgateway och en virtuell nätverksgateway. Kommandot thrid skapar en AzGatewayCustomBgpIpConfigurationObject. Det tredje kommandot skapar den här nya virtuella nätverksgatewayanslutningen med GatewayCustomBgpIpAddress.
Parametrar
-AsJob
Kör cmdlet i bakgrunden
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-AuthorizationKey
AuthorizationKey.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Confirm
Uppmanar dig att bekräfta innan du kör cmdleten.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ConnectionMode
Virtuell nätverksgateway Anslut ionsläge.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ConnectionProtocol
Protokoll för gatewayanslutning:IKEv1/IKEv2
Type: | String |
Accepted values: | IKEv1, IKEv2 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ConnectionType
Gatewayanslutningstyp:IPsec/Vnet2Vnet/ExpressRoute/VPNClient
Type: | String |
Accepted values: | IPsec, Vnet2Vnet, ExpressRoute, VPNClient |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DefaultProfile
Autentiseringsuppgifter, konto, klientorganisation och prenumeration som används för kommunikation med Azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DpdTimeoutInSeconds
Tidsgräns för död peer-identifiering av anslutningen i sekunder.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-EgressNatRule
Listan över utgående NAT-regler som är associerade med den här Anslut ionen.
Type: | PSResourceId[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EnableBgp
Om en BGP-session ska upprättas via en S2S VPN-tunnel
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-EnablePrivateLinkFastPath
Kringgå ExpressRoute-gatewayen vid åtkomst till privata länkar. ExpressRoute FastPath (ExpressRouteGatewayBypass) måste vara aktiverat.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ExpressRouteGatewayBypass
Om du vill använda accelererad åtkomst till virtuella nätverk genom att kringgå gateway
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Force
Be inte om bekräftelse om du vill skriva över en resurs
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-GatewayCustomBgpIpAddress
GatewayCustomBgpIpAddress för virtuell nätverksgateway som används i den här anslutningen.
Type: | PSGatewayCustomBgpIpConfiguration[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-IngressNatRule
Listan över ingress-NAT-regler som är associerade med den här Anslut ionen.
Type: | PSResourceId[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-IpsecPolicies
En lista över IPSec-principer.
Type: | PSIpsecPolicy[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-LocalNetworkGateway2
lokal nätverksgateway.
Type: | PSLocalNetworkGateway |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Location
plats.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
Resursnamnet.
Type: | String |
Aliases: | ResourceName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Peer
Peer
Type: | PSPeering |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PeerId
PeerId
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
Resursgruppens namn.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-RoutingWeight
RoutingWeight.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SharedKey
Ipsec-resursnyckeln.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Tag
En hashtable som representerar resurstaggar.
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TrafficSelectorPolicy
En lista över principer för trafikväljare.
Type: | PSTrafficSelectorPolicy[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-UseLocalAzureIpAddress
Om du vill använda PrivateIP för den här S2S VPN-tunneln
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-UsePolicyBasedTrafficSelectors
Om du vill använda principbaserade trafikväljare för en S2S-anslutning
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VirtualNetworkGateway1
Första virtuella nätverksgatewayen.
Type: | PSVirtualNetworkGateway |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-VirtualNetworkGateway2
Den andra virtuella nätverksgatewayen.
Type: | PSVirtualNetworkGateway |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-WhatIf
Visar vad som skulle hända om cmdleten kördes. Cmdleten körs inte.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Indata
PSGatewayCustomBgpIpConfiguration[]
Utdata
PSVirtualNetworkGatewayConnection