Set-AzExpressRouteGateway

更新 可調整的 ExpressRoute 閘道。

Syntax

Set-AzExpressRouteGateway
   -ResourceGroupName <String>
   -Name <String>
   [-MinScaleUnits <UInt32>]
   [-MaxScaleUnits <UInt32>]
   [-Tag <Hashtable>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzExpressRouteGateway
   -InputObject <PSExpressRouteGateway>
   [-MinScaleUnits <UInt32>]
   [-MaxScaleUnits <UInt32>]
   [-Tag <Hashtable>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzExpressRouteGateway
   -ResourceId <String>
   [-MinScaleUnits <UInt32>]
   [-MaxScaleUnits <UInt32>]
   [-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

參數

-AsJob

在背景執行 Cmdlet

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

執行 Cmdlet 之前先提示您確認。

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

需要更新的 ExpressRouteGateway。

Type:PSExpressRouteGateway
Aliases:ExpressRouteGateway
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-MaxScaleUnits

此 ExpressRouteGateway 的最大縮放單位數目。 有效範圍 > 2

Type:UInt32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MinScaleUnits

此 ExpressRouteGateway 的縮放單位數目下限。 有效範圍 > 2

Type:UInt32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

資源名稱。

Type:String
Aliases:ResourceName, ExpressRouteGatewayName, GatewayName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

要更新之 ExpressRouteGateway 的資源組名。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceId

需要更新之 ExpressRouteGateway 的標識碼。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Tag

表示資源標記的哈希表。

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

顯示執行 Cmdlet 後會發生的情況。 未執行 Cmdlet。

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

輸入

PSVirtualHub

String

輸出

PSExpressRouteGateway