Update-AzVpnGateway
更新可調整的 VPN 閘道。
語法
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>]
Update-AzVpnGateway
-InputObject <PSVpnGateway>
[-VpnConnection <PSVpnConnection[]>]
[-VpnGatewayNatRule <PSVpnGatewayNatRule[]>]
[-VpnGatewayScaleUnit <UInt32>]
[-BgpPeeringAddress <PSIpConfigurationBgpPeeringAddress[]>]
[-EnableBgpRouteTranslationForNat <Boolean>]
[-Tag <Hashtable>]
[-Asn <UInt32>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
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
Update-AzVpnGateway Cmdlet 會更新可調整的 VPN 閘道。
Azure VPN 閘道是 VirtualHub 內站對站連線的軟體定義連線能力。 此閘道會根據使用者指定的縮放單位來重設大小和縮放比例。 您可以從稱為 VPN 月臺的分支/月台設定連線到可調整的閘道。 每個連線都包含 2 個 Active-Active 通道
範例
範例 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
上述會在美國西部的 「testRG」 資源群組中建立資源群組、虛擬 WAN、虛擬網路、虛擬中樞。 VPN 閘道之後將會在虛擬中樞中建立 2 個縮放單位。
建立閘道之後,它會使用 Update-AzVpnGateway 將閘道升級為3個縮放單位。
範例 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
上述會在美國西部的 「testRG」 資源群組中建立資源群組、虛擬 WAN、虛擬網路、虛擬中樞。 VPN 閘道之後將會在虛擬中樞中建立 2 個縮放單位。
建立閘道之後,它會使用 Set-AzVpnGateway 來更新 BgpPeeringAddress。
範例 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
上述範例會更新虛擬 WAN VPN 閘道,以使用預設 BgpPeeringAddress。
範例 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)
上述範例會更新虛擬 WAN VPN 閘道,以使用預設 BgpPeeringAddress。
它會使用 Update-AzVpnGateway 來更新 BgpPeeringAddress
參數
-AsJob
在背景執行 Cmdlet
類型: | SwitchParameter |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Asn
適用於 BGP over VPN 的 VPN 閘道 ASN
類型: | UInt32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-BgpPeeringAddress
此 VpnGateway bgpsettings 的 BGP 對等互連位址。
類型: | PSIpConfigurationBgpPeeringAddress[] |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Confirm
在執行 Cmdlet 之前,提示您進行確認。
類型: | SwitchParameter |
別名: | cf |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-DefaultProfile
用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。
類型: | IAzureContextContainer |
別名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-EnableBgpRouteTranslationForNat
在此 VpnGateway 上啟用/停用 NAT 的 Bgp 路由轉譯旗標。
類型: | Nullable<T>[Boolean] |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-InputObject
要修改的 vpn 閘道物件
類型: | PSVpnGateway |
別名: | VpnGateway |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-Name
vpn 閘道名稱。
類型: | String |
別名: | ResourceName, VpnGatewayName, GatewayName |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-ResourceGroupName
資源組名。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-ResourceId
要修改之 VpnGateway 的 Azure 資源識別碼。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-Tag
表示資源標記的哈希表。
類型: | Hashtable |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-VpnConnection
此 VpnGateway 必須擁有的 VpnConnections 清單。
類型: | PSVpnConnection[] |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-VpnGatewayNatRule
與此 VpnGateway 相關聯的 VpnGatewayNatRules 清單。
類型: | PSVpnGatewayNatRule[] |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-VpnGatewayScaleUnit
此 VpnGateway 的縮放單位。
類型: | UInt32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-WhatIf
顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。
類型: | SwitchParameter |
別名: | wi |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |