Update-AzVpnGateway
Updates a scalable VPN gateway.
Syntax
ByVpnGatewayName (Default)
Update-AzVpnGateway
-ResourceGroupName <String>
-Name <String>
[-VpnConnection <PSVpnConnection[]>]
[-VpnGatewayNatRule <PSVpnGatewayNatRule[]>]
[-VpnGatewayScaleUnit <UInt32>]
[-BgpPeeringAddress <PSIpConfigurationBgpPeeringAddress[]>]
[-EnableBgpRouteTranslationForNat <Boolean>]
[-Tag <Hashtable>]
[-Asn <UInt32>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByVpnGatewayObject
Update-AzVpnGateway
-InputObject <PSVpnGateway>
[-VpnConnection <PSVpnConnection[]>]
[-VpnGatewayNatRule <PSVpnGatewayNatRule[]>]
[-VpnGatewayScaleUnit <UInt32>]
[-BgpPeeringAddress <PSIpConfigurationBgpPeeringAddress[]>]
[-EnableBgpRouteTranslationForNat <Boolean>]
[-Tag <Hashtable>]
[-Asn <UInt32>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByVpnGatewayResourceId
Update-AzVpnGateway
-ResourceId <String>
[-VpnConnection <PSVpnConnection[]>]
[-VpnGatewayNatRule <PSVpnGatewayNatRule[]>]
[-VpnGatewayScaleUnit <UInt32>]
[-BgpPeeringAddress <PSIpConfigurationBgpPeeringAddress[]>]
[-EnableBgpRouteTranslationForNat <Boolean>]
[-Tag <Hashtable>]
[-Asn <UInt32>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Update-AzVpnGateway cmdlet updates a scalable VPN gateway.
An Azure VPN gateway is a software defined connectivity for site to site connections inside the VirtualHub. This gateway resizes and scales based on the scale unit specified by the user. A connection can be set up from a branch/site known as VPN site to the scalable gateway. Each connection comprises of 2 Active-Active tunnels
Examples
Example 1
New-AzResourceGroup -Location "West US" -Name "testRG"
$virtualWan = New-AzVirtualWan -ResourceGroupName testRG -Name myVirtualWAN -Location "West US"
$virtualHub = New-AzVirtualHub -VirtualWan $virtualWan -ResourceGroupName "testRG" -Name "westushub" -AddressPrefix "10.0.0.1/24"
$vpnGateway = New-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw" -VirtualHubId $virtualHub.Id -VpnGatewayScaleUnit 2
Update-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw" -VpnGatewayScaleUnit 3
ResourceGroupName : testRG
Name : testvpngw
Id : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/vpnGateways/testvpngw
Location : West US
VpnGatewayScaleUnit : 3
VirtualHub : /subscriptions/{subscriptionId}/resourceGroups/Ali_pS_Test/providers/Microsoft.Network/virtualHubs/westushub
BgpSettings : {}
Type : Microsoft.Network/vpnGateways
ProvisioningState : Succeeded
The above will create a resource group, Virtual WAN, Virtual Network, Virtual Hub in West US in "testRG" resource group in Azure.
A VPN gateway will be created thereafter in the Virtual Hub with 2 scale units.
After the gateway has been created, it uses Update-AzVpnGateway to upgrade the gateway to 3 scale units.
Example 2
New-AzResourceGroup -Location "West US" -Name "testRG"
$virtualWan = New-AzVirtualWan -ResourceGroupName testRG -Name myVirtualWAN -Location "West US"
$virtualHub = New-AzVirtualHub -VirtualWan $virtualWan -ResourceGroupName "testRG" -Name "westushub" -AddressPrefix "10.0.0.1/24"
$vpnGateway = New-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw" -VirtualHubId $virtualHub.Id -VpnGatewayScaleUnit 2
$ipconfigurationId1 = 'Instance0'
$addresslist1 = @('169.254.21.5')
$gw1ipconfBgp1 = New-AzIpConfigurationBgpPeeringAddressObject -IpConfigurationId $ipconfigurationId1 -CustomAddress $addresslist1
$ipconfigurationId2 = 'Instance1'
$addresslist2 = @('169.254.21.10')
$gw1ipconfBgp2 = New-AzIpConfigurationBgpPeeringAddressObject -IpConfigurationId $ipconfigurationId2 -CustomAddress $addresslist2
$gw = Get-AzVpnGateway -ResourceGroupName testRg -Name testgw
Update-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw" -BgpPeeringAddress @($gw1ipconfBgp1,$gw1ipconfBgp2)
ResourceGroupName : testRG
Name : testvpngw
Id : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/vpnGateways/testvpngw
Location : West US
VpnGatewayScaleUnit : 3
VirtualHub : /subscriptions/{subscriptionId}/resourceGroups/Ali_pS_Test/providers/Microsoft.Network/virtualHubs/westushub
BgpSettings : {}
Type : Microsoft.Network/vpnGateways
ProvisioningState : Succeeded
The above will create a resource group, Virtual WAN, Virtual Network, Virtual Hub in West US in "testRG" resource group in Azure.
A VPN gateway will be created thereafter in the Virtual Hub with 2 scale units.
After the gateway has been created, it uses Set-AzVpnGateway to update BgpPeeringAddress.
Example 3
$gw = Get-AzVpnGateway -ResourceGroupName "testRg" -Name "testgw"
$gw.BgpSettings.BgpPeeringAddresses
$gw.BgpSettings.BgpPeeringAddresses[0].CustomBgpIpAddresses=$null
$gw.BgpSettings.BgpPeeringAddresses[1].CustomBgpIpAddresses=$null
$gw.BgpSettings.BgpPeeringAddresses
Update-AzVpnGateway -InputObject $gw
The above example will update the Virtual WAN VPN Gateway to use the default BgpPeeringAddress.
Example 4
New-AzResourceGroup -Location "West US" -Name "testRG"
$virtualWan = New-AzVirtualWan -ResourceGroupName testRG -Name myVirtualWAN -Location "West US"
$virtualHub = New-AzVirtualHub -VirtualWan $virtualWan -ResourceGroupName "testRG" -Name "westushub" -AddressPrefix "10.0.0.1/24"
$vpnGateway = New-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw" -VirtualHubId $virtualHub.Id -VpnGatewayScaleUnit 2
$ipconfigurationId1 = 'Instance0'
$addresslist1 = @()
$gw1ipconfBgp1 = New-AzIpConfigurationBgpPeeringAddressObject -IpConfigurationId $ipconfigurationId1 -CustomAddress $addresslist1
$ipconfigurationId2 = 'Instance1'
$addresslist2 = @()
$gw1ipconfBgp2 = New-AzIpConfigurationBgpPeeringAddressObject -IpConfigurationId $ipconfigurationId2 -CustomAddress $addresslist2
$gw = Get-AzVpnGateway -ResourceGroupName testRg -Name testgw
Update-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw" -BgpPeeringAddress @($gw1ipconfBgp1,$gw1ipconfBgp2)
The above example will update the Virtual WAN VPN Gateway to use the default BgpPeeringAddress.
It uses Update-AzVpnGateway to update BgpPeeringAddress
Parameters
-AsJob
Run cmdlet in the background
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Asn
The vpn gateway's ASN for BGP over VPN
Parameter properties
Type: UInt32
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-BgpPeeringAddress
The BGP peering addresses for this VpnGateway bgpsettings.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-EnableBgpRouteTranslationForNat
Flag to enable/disable Bgp route translation for NAT on this VpnGateway.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
The vpn gateway object to be modified
Type: PSVpnGateway
Default value: None
Supports wildcards: False
DontShow: False
Aliases: VpnGateway
ByVpnGatewayObject
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-Name
The vpn gateway name.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: ResourceName, VpnGatewayName, GatewayName
Parameter sets
ByVpnGatewayName
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
The resource group name.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByVpnGatewayName
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceId
The Azure resource ID of the VpnGateway to be modified.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByVpnGatewayResourceId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Tag
A hashtable which represents resource tags.
Parameter properties
Type: Hashtable
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-VpnConnection
The list of VpnConnections that this VpnGateway needs to have.
Parameter properties
Type: PSVpnConnection [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-VpnGatewayNatRule
The list of VpnGatewayNatRules that are associated with this VpnGateway.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-VpnGatewayScaleUnit
The scale unit for this VpnGateway.
Parameter properties
Type: UInt32
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs