Set-AzVirtualNetworkGatewayConnection
Configures a virtual network gateway connection.
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
Syntax
Set-AzVirtualNetworkGatewayConnection
-VirtualNetworkGatewayConnection <PSVirtualNetworkGatewayConnection>
[-EnableBgp <Boolean>]
[-DpdTimeoutInSeconds <Int32>]
[-ConnectionMode <String>]
[-UsePolicyBasedTrafficSelectors <Boolean>]
[-UseLocalAzureIpAddress <Boolean>]
[-IpsecPolicies <PSIpsecPolicy[]>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-IngressNatRule <PSResourceId[]>]
[-EgressNatRule <PSResourceId[]>]
[-Force]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzVirtualNetworkGatewayConnection
-VirtualNetworkGatewayConnection <PSVirtualNetworkGatewayConnection>
[-EnableBgp <Boolean>]
[-DpdTimeoutInSeconds <Int32>]
[-ConnectionMode <String>]
[-UsePolicyBasedTrafficSelectors <Boolean>]
[-UseLocalAzureIpAddress <Boolean>]
[-IpsecPolicies <PSIpsecPolicy[]>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-IngressNatRule <PSResourceId[]>]
[-EgressNatRule <PSResourceId[]>]
-Tag <Hashtable>
[-Force]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzVirtualNetworkGatewayConnection cmdlet configures a virtual network gateway connection.
Examples
Example 1:
$conn = Get-AzVirtualNetworkGatewayConnection -Name 1 -ResourceGroupName myRG
Set-AzVirtualNetworkGatewayConnection -VirtualNetworkGatewayConnection $conn
Confirm
Are you sure you want to overwrite resource '1'
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
Name : 1
ResourceGroupName : myRG
Location : westus
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Mi
crosoft.Network/connections/1
Etag : W/"00000000-0000-0000-0000-000000000000"
ResourceGuid : 00000000-0000-0000-0000-000000000000
ProvisioningState : Succeeded
Tags :
AuthorizationKey :
VirtualNetworkGateway1 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/M
icrosoft.Network/virtualNetworkGateways/myGateway"
VirtualNetworkGateway2 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S2SVnetConn/providers/Mic
rosoft.Network/virtualNetworkGateways/S2SConnGW"
LocalNetworkGateway2 :
Peer :
RoutingWeight : 0
SharedKey :
ConnectionStatus : Connected
EgressBytesTransferred : 91334484
IngressBytesTransferred : 100386089
TunnelConnectionStatus : []
Example 2: Add/Update tags to an existing VirtualNetworkGatewayConnection
$conn = Get-AzVirtualNetworkGatewayConnection -Name 1 -ResourceGroupName myRG
Set-AzVirtualNetworkGatewayConnection -VirtualNetworkGatewayConnection $conn -Tag @{ testtagKey="SomeTagKey"; testtagValue="SomeKeyValue" }
Confirm
Are you sure you want to overwrite resource '1'
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
Name : 1
ResourceGroupName : myRG
Location : westus
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Mi
crosoft.Network/connections/1
Etag : W/"00000000-0000-0000-0000-000000000000"
ResourceGuid : 00000000-0000-0000-0000-000000000000
ProvisioningState : Succeeded
Tags :
Name Value
============ ============
testtagValue SomeKeyValue
testtagKey SomeTagKey
AuthorizationKey :
VirtualNetworkGateway1 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/M
icrosoft.Network/virtualNetworkGateways/myGateway"
VirtualNetworkGateway2 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S2SVnetConn/providers/Mic
rosoft.Network/virtualNetworkGateways/S2SConnGW"
LocalNetworkGateway2 :
Peer :
RoutingWeight : 0
SharedKey :
ConnectionStatus : Connected
EgressBytesTransferred : 91334484
IngressBytesTransferred : 100386089
TunnelConnectionStatus : []
Example 3: Add/Remove natRules to an existing VirtualNetworkGatewayConnection
$conn = Get-AzVirtualNetworkGatewayConnection -Name 1 -ResourceGroupName myRG
$egressNatrule = get-azVirtualNetworkGatewayNatRule -ResourceGroupName myRG -Name "natRule1" -ParentResourceName "gw1"
Set-AzVirtualNetworkGatewayConnection -VirtualNetworkGatewayConnection $conn -IngressNatRule @() -EgressNatRule $egressNatrule
Confirm
Are you sure you want to overwrite resource '1'
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
Name : 1
ResourceGroupName : myRG
Location : westus
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Mi
crosoft.Network/connections/1
Etag : W/"00000000-0000-0000-0000-000000000000"
ResourceGuid : 00000000-0000-0000-0000-000000000000
ProvisioningState : Succeeded
Tags :
Name Value
============ ============
testtagValue SomeKeyValue
testtagKey SomeTagKey
AuthorizationKey :
VirtualNetworkGateway1 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/M
icrosoft.Network/virtualNetworkGateways/myGateway"
VirtualNetworkGateway2 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S2SVnetConn/providers/Mic
rosoft.Network/virtualNetworkGateways/S2SConnGW"
LocalNetworkGateway2 :
Peer :
RoutingWeight : 0
SharedKey :
ConnectionStatus : Connected
EgressBytesTransferred : 91334484
IngressBytesTransferred : 100386089
TunnelConnectionStatus : []
IngressNatRules : []
EgressNatRules : [
{
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Network/virtualNetworkGateways/gw1/natRules/natRule1"
}
]
The first command gets a virtual network gateway connection named 1 that belongs to resource group myRG and stores it to the variable named $conn. The second command gets the virtual network gateway natRule named natRule1 and stores it to the variable named $egressNatrule. The third command sets virtual network gateway connection with removed all IngressNatRules and add egressNatrule into EgressNatRules.
Parameters
Run cmdlet in the background
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
| Type: | SwitchParameter |
| Aliases: | cf |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Virtual Network Gateway Connection Mode.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Dead Peer Detection Timeout of the connection in seconds.
| Type: | Int32 |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The list of egress NAT rules that are associated with this Connection.
| Type: | PSResourceId[] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Whether to use a BGP session over a S2S VPN tunnel
| Type: | Nullable<T>[Boolean] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Do not ask for confirmation if you want to overwrite a resource
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The list of ingress NAT rules that are associated with this Connection.
| Type: | PSResourceId[] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
A list of IPSec policies.
| Type: | PSIpsecPolicy[] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
A hashtable which represents resource tags.
| Type: | Hashtable |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
A list of Traffic Selector policies.
| Type: | PSTrafficSelectorPolicy[] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Whether to use PrivateIP for a S2S connection
| Type: | Nullable<T>[Boolean] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Whether to use policy-based traffic selectors for a S2S connection
| Type: | Nullable<T>[Boolean] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies the PSVirtualNetworkGatewayConnection object that this cmdlet uses to modify the virtual network gateway connection.
| Type: | PSVirtualNetworkGatewayConnection |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
| Type: | SwitchParameter |
| Aliases: | wi |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Inputs
PSVirtualNetworkGatewayConnection
Nullable<T>[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Nullable<T>[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Outputs
PSVirtualNetworkGatewayConnection