你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Set-AzExpressRouteGateway

Updates a Scalable ExpressRoute Gateway.

Syntax

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

The Set-AzExpressRouteGateway cmdlet enables you to update the scale units for an existing ExpressRouteGateway or update the resource tags.

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"
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

The above will create a resource group "testRG", a Virtual WAN and a Virtual Hub in West US in that resource group in Azure. An ExpressRoute gateway will be created thereafter in the Virtual Hub with 2 scale units which will then be modified to 3 scale units.

Example 2: Configure this gateway to accept traffic from non Virtual Wan networks.

You may either retrieve the gateway, configure its AllowNonVirtualWanTraffic property and save the changes on the gateway or you may just use the switch on the 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

Example 3: Configure this gateway to block traffic from non Virtual Wan networks.

You may either retrieve the gateway, configure its AllowNonVirtualWanTraffic property and save the changes on the gateway or you may just use the switch on the 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

Parameters

-AllowNonVirtualWanTraffic

Determines whether this gateway should accept traffic from other VNets

Type:Nullable<T>[Boolean]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-AsJob

Run cmdlet in the background

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

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

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

-InputObject

The ExpressRouteGateway that needs to be updated.

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

-MaxScaleUnits

The maximum number of scale units for this ExpressRouteGateway. Valid range > 2

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

-MinScaleUnits

The minimum number of scale units for this ExpressRouteGateway. Valid range > 2

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

-Name

The resource name.

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

-ResourceGroupName

The resource group name of the ExpressRouteGateway to be updated.

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

-ResourceId

The Id of the ExpressRouteGateway that needs to be updated.

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

-Tag

A hashtable which represents resource tags.

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

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

Inputs

PSVirtualHub

String

Outputs

PSExpressRouteGateway