New-AzureRmVirtualNetworkGatewayConnection
Creates the Site-to-Site VPN connection between the virtual network gateway and the on-prem VPN device.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are
advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and
updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing
any continued use at the user's discretion and risk. Please refer to our
migration resources for guidance on transitioning to the Az module.
Syntax
New-AzureRmVirtualNetworkGatewayConnection
-Name <String>
-ResourceGroupName <String>
-Location <String>
[-AuthorizationKey <String>]
-VirtualNetworkGateway1 <PSVirtualNetworkGateway>
[-VirtualNetworkGateway2 <PSVirtualNetworkGateway>]
[-LocalNetworkGateway2 <PSLocalNetworkGateway>]
-ConnectionType <String>
[-RoutingWeight <Int32>]
[-SharedKey <String>]
[-Peer <PSPeering>]
[-EnableBgp <Boolean>]
[-Tag <Hashtable>]
[-Force]
[-UsePolicyBasedTrafficSelectors <Boolean>]
[-IpsecPolicies <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSIpsecPolicy]>]
[-ExpressRouteGatewayBypass]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzureRmVirtualNetworkGatewayConnection
-Name <String>
-ResourceGroupName <String>
-Location <String>
[-AuthorizationKey <String>]
-VirtualNetworkGateway1 <PSVirtualNetworkGateway>
[-VirtualNetworkGateway2 <PSVirtualNetworkGateway>]
[-LocalNetworkGateway2 <PSLocalNetworkGateway>]
-ConnectionType <String>
[-RoutingWeight <Int32>]
[-SharedKey <String>]
[-PeerId <String>]
[-EnableBgp <Boolean>]
[-Tag <Hashtable>]
[-Force]
[-UsePolicyBasedTrafficSelectors <Boolean>]
[-IpsecPolicies <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSIpsecPolicy]>]
[-ExpressRouteGatewayBypass]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Creates the Site-to-Site VPN connection between the virtual network gateway and the on-prem VPN device.
Examples
Example 1
New-AzureRmVirtualNetworkGatewayConnection -Name conn-client-1 -ResourceGroupName $RG1 -VirtualNetworkGateway1 $vnetgw1 -VirtualNetworkGateway2 $vnetgw2 -Location $loc1 -ConnectionType Vnet2Vnet -SharedKey 'a1b2c3d4e5'
Parameters
-AsJob
Run cmdlet in the background
Type: SwitchParameter
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False
-AuthorizationKey
Type: String
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Aliases: cf
Position: Named
Default value: False
Required: False
Accept pipeline input: False
Accept wildcard characters: False
-ConnectionType
Type: String
Accepted values: IPsec, Vnet2Vnet, ExpressRoute, VPNClient
Position: Named
Default value: None
Required: True
Accept pipeline input: True
Accept wildcard characters: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Type: IAzureContextContainer
Aliases: AzureRmContext, AzureCredential
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False
-EnableBgp
Type: Boolean
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-ExpressRouteGatewayBypass
Type: SwitchParameter
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-Force
Type: SwitchParameter
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False
-IpsecPolicies
A list of IPSec policies.
Type: List<T> [ PSIpsecPolicy ]
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-LocalNetworkGateway2
Type: PSLocalNetworkGateway
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-Location
Type: String
Position: Named
Default value: None
Required: True
Accept pipeline input: True
Accept wildcard characters: False
-Name
Type: String
Aliases: ResourceName
Position: Named
Default value: None
Required: True
Accept pipeline input: True
Accept wildcard characters: False
-Peer
Type: PSPeering
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-PeerId
Type: String
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-ResourceGroupName
Type: String
Position: Named
Default value: None
Required: True
Accept pipeline input: True
Accept wildcard characters: False
-RoutingWeight
Type: Int32
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-SharedKey
Type: String
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-Tag
Key-value pairs in the form of a hash table. For example:
@{key0="value0";key1=$null;key2="value2"}
Type: Hashtable
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-UsePolicyBasedTrafficSelectors
Use policy-based traffic selectors for a S2S connection
Type: Boolean
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False
-VirtualNetworkGateway1
Type: PSVirtualNetworkGateway
Position: Named
Default value: None
Required: True
Accept pipeline input: True
Accept wildcard characters: False
-VirtualNetworkGateway2
Type: PSVirtualNetworkGateway
Position: Named
Default value: None
Required: False
Accept pipeline input: True
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Type: SwitchParameter
Aliases: wi
Position: Named
Default value: False
Required: False
Accept pipeline input: False
Accept wildcard characters: False
String
PSVirtualNetworkGateway
PSLocalNetworkGateway
Int32
PSPeering
Boolean
Hashtable
List<T> [ [ Microsoft.Azure.Commands.Network.Models.PSIpsecPolicy, Microsoft.Azure.Commands.Network, Version=6.4.1.0, Culture=neutral, PublicKeyToken=null ] ]
Outputs
PSVirtualNetworkGatewayConnection