Set-AzExpressRouteGateway
更新可調整的 ExpressRoute 閘道。
語法
Set-AzExpressRouteGateway
-ResourceGroupName <String>
-Name <String>
[-MinScaleUnits <UInt32>]
[-MaxScaleUnits <UInt32>]
[-AllowNonVirtualWanTraffic <Boolean>]
[-Tag <Hashtable>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzExpressRouteGateway
-InputObject <PSExpressRouteGateway>
[-MinScaleUnits <UInt32>]
[-MaxScaleUnits <UInt32>]
[-AllowNonVirtualWanTraffic <Boolean>]
[-Tag <Hashtable>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzExpressRouteGateway
-ResourceId <String>
[-MinScaleUnits <UInt32>]
[-MaxScaleUnits <UInt32>]
[-AllowNonVirtualWanTraffic <Boolean>]
[-Tag <Hashtable>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Set-AzExpressRouteGateway Cmdlet 可讓您更新現有 ExpressRouteGateway 的縮放單位,或更新資源標籤。
範例
範例 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"
New-AzExpressRouteGateway -ResourceGroupName "testRG" -Name "testergw" -VirtualHubId $virtualHub.Id -MinScaleUnits 2
Set-AzExpressRouteGateway -ResourceGroupName "testRG" -Name "testergw" -MinScaleUnits 3
ResourceGroupName : testRG
Name : testergw
Id : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/expressRouteGateways/testergw
Location : West US
MinScaleUnits : 3
Type : Microsoft.Network/expressRouteGateways
ProvisioningState : Succeeded
上述會建立資源群組 「testRG」、虛擬 WAN 和美國西部的虛擬中樞,並在 Azure 中的該資源群組中建立虛擬中樞。 ExpressRoute 閘道之後將會在虛擬中樞中建立 2 個縮放單位,然後修改為 3 個縮放單位。
範例 2:設定此閘道以接受來自非虛擬網路的流量。
您可以擷取閘道、設定其 AllowNonVirtualWanTraffic 屬性,並將變更儲存在閘道上,或者您只要在 Set-AzExpressRouteGateway Cmdlet 上使用 參數
# Option 1 - Retrieve the gateway object, configure it to allow traffic from VNets and persist those changes.
$gateway = Get-AzExpressRouteGateway -ResourceGroupName "resourceGroup001" -Name "gateway001"
$gateway.AllowNonVirtualWanTraffic = $true
$gateway = Set-AzExpressRouteGateway -InputObject $gateway
# Option 2 - Use the cmdlet switch
Set-AzExpressRouteGateway -ResourceGroupName "resourceGroup001" -Name "gateway001" -AllowNonVirtualWanTraffic $true
範例 3:設定此閘道以封鎖來自非虛擬網路的流量。
您可以擷取閘道、設定其 AllowNonVirtualWanTraffic 屬性,並將變更儲存在閘道上,或者您只要在 Set-AzExpressRouteGateway Cmdlet 上使用 參數
# Option 1 - Retrieve the gateway object, configure it to block traffic from VNets and persist those changes.
$gateway=Get-AzExpressRouteGateway -ResourceGroupName "resourceGroup001" -Name "gateway001"
$gateway.AllowNonVirtualWanTraffic = $false
$gateway = Set-AzExpressRouteGateway -InputObject $gateway
# Option 2 - Use the cmdlet switch
Set-AzExpressRouteGateway -ResourceGroupName "resourceGroup001" -Name "gateway001" -AllowNonVirtualWanTraffic $false
參數
-AllowNonVirtualWanTraffic
判斷此閘道是否應該接受來自其他 VNet 的流量
類型: | Nullable<T>[Boolean] |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | True |
接受萬用字元: | False |
-AsJob
在背景執行 Cmdlet
類型: | SwitchParameter |
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 |
-InputObject
需要更新的 ExpressRouteGateway。
類型: | PSExpressRouteGateway |
別名: | ExpressRouteGateway |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-MaxScaleUnits
此 ExpressRouteGateway 的最大縮放單位數目。 有效範圍 > 2
類型: | UInt32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-MinScaleUnits
此 ExpressRouteGateway 的縮放單位數目下限。 有效範圍 > 2
類型: | UInt32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Name
資源名稱。
類型: | String |
別名: | ResourceName, ExpressRouteGatewayName, GatewayName |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-ResourceGroupName
要更新之 ExpressRouteGateway 的資源組名。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-ResourceId
需要更新之 ExpressRouteGateway 的標識碼。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-Tag
表示資源標記的哈希表。
類型: | Hashtable |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-WhatIf
顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。
類型: | SwitchParameter |
別名: | wi |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |