使用 PowerShell 修改 ExpressRoute 线路(经典)Modify an ExpressRoute circuit using PowerShell (classic)

本文逐步讲解检查状态以及更新或删除并预配 ExpressRoute 经典部署模型线路的步骤。This article walks you through the steps to check the status, update, or delete and deprovision your ExpressRoute classic deployment model circuit. 本文适用于经典部署模型。This article applies to the classic deployment model.

Important

从 2017 年 3 月 1 日开始,将无法在经典部署模型中创建新的 ExpressRoute 线路。As of March 1, 2017, you can't create new ExpressRoute circuits in the classic deployment model.

  • 可以将现有的 ExpressRoute 线路从经典部署模型移到 Resource Manager 部署模型,不会遇到连接中断问题。You can move an existing ExpressRoute circuit from the classic deployment model to the Resource Manager deployment model without experiencing any connectivity down time. 有关详细信息,请参阅移动现有线路For more information, see Move an existing circuit.
  • allowClassicOperations 设置为 TRUE 即可在经典部署模型中连接到虚拟网络。You can connect to virtual networks in the classic deployment model by setting allowClassicOperations to TRUE.

请使用以下链接在 Resource Manager 部署模型中创建和管理 ExpressRoute 线路:Use the following links to create and manage ExpressRoute circuits in the Resource Manager deployment model:

关于 Azure 部署模型About Azure deployment models

Azure 当前使用两种部署模型:资源管理器部署模型和经典部署模型。Azure currently works with two deployment models: Resource Manager and classic. 这两个模型不是完全兼容的。The two models are not completely compatible with each other. 在开始之前,需要知道所要使用的模型。Before you begin, you need to know which model that you want to work in. 有关部署模型的信息,请参阅了解部署模型For information about the deployment models, see Understanding deployment models. 如果不熟悉 Azure,建议使用 Resource Manager 部署模型。If you are new to Azure, we recommend that you use the Resource Manager deployment model.

准备阶段Before you begin

安装最新版本的 Azure 服务管理 (SM) PowerShell 模块和 ExpressRoute 模块。Install the latest versions of the Azure Service Management (SM) PowerShell modules and the ExpressRoute module. 不能使用 Azure CloudShell 环境来运行 SM 模块。You can't use the Azure CloudShell environment to run SM modules.

  1. 按照安装服务管理模块一文中的说明安装 Azure 服务管理模块。Use the instructions in the Installing the Service Management module article to install the Azure Service Management Module. 如果已安装 Az 或 RM 模块,请确保使用“-AllowClobber”。If you have the Az or RM module already installed, be sure to use '-AllowClobber'.

  2. 导入已安装的模块。Import the installed modules. 使用以下示例时,请调整路径以反映已安装的 PowerShell 模块的位置。When using the following example, adjust the path to reflect the location of your installed PowerShell modules.

    Import-Module 'C:\Program Files\WindowsPowerShell\Modules\Azure\5.3.0\Azure.psd1'
    Import-Module 'C:\Program Files\WindowsPowerShell\Modules\Azure\5.3.0\ExpressRoute\ExpressRoute.psd1'
    
  3. 若要登录到 Azure 帐户,请使用提升的权限打开 PowerShell 控制台,并连接到帐户。To sign in to your Azure account, open your PowerShell console with elevated rights and connect to your account. 使用以下示例帮助你通过服务管理模块进行连接:Use the following example to help you connect using the Service Management module:

    Add-AzureAccount -Environment AzureChinaCloud
    

获取线路的状态Get the status of a circuit

可以随时使用 Get-AzureCircuit cmdlet 检索此信息。You can retrieve this information at any time by using the Get-AzureCircuit cmdlet. 不带任何参数的调用会列出所有线路。Making the call without any parameters lists all the circuits.

Get-AzureDedicatedCircuit

Bandwidth                        : 200
CircuitName                      : MyTestCircuit
Location                         : Beijing
ServiceKey                       : *********************************
ServiceProviderName              : Beijing Telecom Ethernet
ServiceProviderProvisioningState : Provisioned
Sku                              : Standard
Status                           : Enabled

可以将服务密钥作为参数传递给调用,从而获取特定 ExpressRoute 线路的相关信息。You can get information on a specific ExpressRoute circuit by passing the service key as a parameter to the call.

Get-AzureDedicatedCircuit -ServiceKey "*********************************"

Bandwidth                        : 200
CircuitName                      : MyTestCircuit
Location                         : Beijing
ServiceKey                       : *********************************
ServiceProviderName              : Beijing Telecom Ethernet
ServiceProviderProvisioningState : Provisioned
Sku                              : Standard
Status                           : Enabled

可以通过运行以下示例获取所有这些参数的详细说明:You can get detailed descriptions of all the parameters by running the following example:

get-help get-azurededicatedcircuit -detailed

修改线路Modify a circuit

可以在不影响连接的情况下修改 ExpressRoute 线路的某些属性。You can modify certain properties of an ExpressRoute circuit without impacting connectivity.

可以在不停机的情况下执行以下任务:You can do the following tasks with no downtime:

  • 为 ExpressRoute 线路启用或禁用 ExpressRoute 高级版外接程序。Enable or disable an ExpressRoute premium add-on for your ExpressRoute circuit.
  • 增加 ExpressRoute 线路的带宽,前提是端口上有可用容量。Increase the bandwidth of your ExpressRoute circuit provided there is capacity available on the port. 不支持对线路的带宽进行降级。Downgrading the bandwidth of a circuit is not supported.
  • 将计量套餐从数据流量套餐更改为无限制流量套餐。Change the metering plan from Metered Data to Unlimited Data. 不支持将计量套餐从无限制流量套餐更改为数据流量套餐。Changing the metering plan from Unlimited Data to Metered Data is not supported.
  • 可以启用和禁用允许经典操作 。You can enable and disable Allow Classic Operations.

有关限制和局限性的详细信息,请参阅 ExpressRoute 常见问题Refer to the ExpressRoute FAQ for more information on limits and limitations.

启用 ExpressRoute 高级版外接程序Enable the ExpressRoute premium add-on

可以使用以下 PowerShell cmdlet 为现有线路启用 ExpressRoute 高级外接程序:You can enable the ExpressRoute premium add-on for your existing circuit by using the following PowerShell cmdlet:

Set-AzureDedicatedCircuitProperties -ServiceKey "*********************************" -Sku Premium

Bandwidth                        : 1000
CircuitName                      : TestCircuit
Location                         : Beijing
ServiceKey                       : *********************************
ServiceProviderName              : Beijing Telecom Ethernet
ServiceProviderProvisioningState : Provisioned
Sku                              : Premium
Status                           : Enabled

现在,线路已启用 ExpressRoute 高级外接程序功能。Your circuit will now have the ExpressRoute premium add-on features enabled. 成功运行该命令后,就会开始对高级版外接程序功能计费。As soon as the command has been successfully run, billing for the premium add-on capability begins.

禁用 ExpressRoute 高级版外接程序Disable the ExpressRoute premium add-on

Important

如果使用的资源超出标准线路允许的范围,此操作可能会失败。This operation can fail if you're using resources that are greater than what is permitted for the standard circuit.

注意事项Considerations

  • 从高级版降级到标准版之前,请确保链接到线路的虚拟网络数少于 10。Make sure that the number of virtual networks linked to the circuit is less than 10 before you downgrade from premium to standard. 否则,更新请求会失败,并且会按高级版费率计费。If you don't do this, your update request fails, and you are billed the premium rates.
  • 必须取消其他地理政治区域的所有虚拟网络的链接。You must unlink all virtual networks in other geopolitical regions. 否则,更新请求会失败,并且会按高级版费率计费。If you don't, your update request fails, and you are billed the premium rates.
  • 路由表中专用对等互连的路由必须少于 4,000。Your route table must be less than 4,000 routes for private peering. 如果路由表大小超出 4,000 个路由,则会删除 BGP 会话且不会重新启用它,除非已播发前缀的数目低于 4,000。If your route table size is greater than 4,000 routes, the BGP session drops and won't be reenabled until the number of advertised prefixes goes below 4,000.

禁用高级外接程序To disable the premium add-on

可以使用以下 PowerShell cmdlet 为现有线路禁用 ExpressRoute 高级外接程序:You can disable the ExpressRoute premium add-on for your existing circuit by using the following PowerShell cmdlet:


Set-AzureDedicatedCircuitProperties -ServiceKey "*********************************" -Sku Standard

Bandwidth                        : 1000
CircuitName                      : TestCircuit
Location                         : Beijing
ServiceKey                       : *********************************
ServiceProviderName              : Beijing Telecom Ethernet
ServiceProviderProvisioningState : Provisioned
Sku                              : Standard
Status                           : Enabled

更新 ExpressRoute 线路带宽Update the ExpressRoute circuit bandwidth

有关提供商支持的带宽选项,请查看 ExpressRoute 常见问题Check the ExpressRoute FAQ for supported bandwidth options for your provider. 只要在其上创建线路的物理端口允许,即可选取大于现有线路大小的任何大小。You can pick any size that is greater than the size of your existing circuit as long as the physical port (on which your circuit is created) allows.

Important

如果现有端口上的容量不足,可能需要重新创建 ExpressRoute 线路。You may have to recreate the ExpressRoute circuit if there is inadequate capacity on the existing port. 如果该位置没有额外的可用容量,则不能升级线路。You cannot upgrade the circuit if there is no additional capacity available at that location.

但是,无法在不中断的情况下降低 ExpressRoute 线路的带宽。You cannot reduce the bandwidth of an ExpressRoute circuit without disruption. 带宽降级需要取消对 ExpressRoute 线路的预配,并重新预配新的 ExpressRoute 线路。Downgrading bandwidth requires you to deprovision the ExpressRoute circuit and then reprovision a new ExpressRoute circuit.

调整线路大小Resize a circuit

确定所需的大小后,可以使用以下命令调整线路的大小:After you decide what size you need, you can use the following command to resize your circuit:

Set-AzureDedicatedCircuitProperties -ServiceKey ********************************* -Bandwidth 1000

Bandwidth                        : 1000
CircuitName                      : TestCircuit
Location                         : Beijing
ServiceKey                       : *********************************
ServiceProviderName              : Beijing Telecom Ethernet
ServiceProviderProvisioningState : Provisioned
Sku                              : Standard
Status                           : Enabled

在 Microsoft 端调整线路大小后,必须联系连接提供商,让他们在那一边根据此更改更新配置。Once your circuit has been sized up on the Microsoft side, you must contact your connectivity provider to update configurations on their side to match this change. 从现在开始将按已更新的带宽选项计费。Billing begins for the updated bandwidth option from this point on.

如果在增加线路带宽时看到以下错误,这意味着创建现有线路的物理端口上没有足够的带宽可用。If you see the following error when increasing the circuit bandwidth, it means there is no sufficient bandwidth left on the physical port where your existing circuit is created. 必须删除此线路,并创建所需大小的新线路。You must delete this circuit and create a new circuit of the size you need.

Set-AzureDedicatedCircuitProperties : InvalidOperation : Insufficient bandwidth available to perform this circuit
update operation
At line:1 char:1
+ Set-AzureDedicatedCircuitProperties -ServiceKey ********************* ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : CloseError: (:) [Set-AzureDedicatedCircuitProperties], CloudException
  + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ExpressRoute.SetAzureDedicatedCircuitPropertiesCommand

取消预配和删除线路Deprovision and delete a circuit

注意事项Considerations

  • 必须取消所有虚拟网络与 ExpressRoute 线路的链接,才能成功执行此操作。You must unlink all virtual networks from the ExpressRoute circuit for this operation to succeed. 如果此操作失败,请查看是否有虚拟网络链接到了此线路。Check to see if you have any virtual networks that are linked to the circuit if this operation fails.
  • 如果 ExpressRoute 线路服务提供商预配状态为“正在预配” 或“已预配” ,则必须与服务提供商合作,在他们一端取消预配线路。If the ExpressRoute circuit service provider provisioning state is Provisioning or Provisioned you must work with your service provider to deprovision the circuit on their side. 在服务提供商取消对线路的预配并通知我们之前,我们会继续保留资源并收费。We continue to reserve resources and bill you until the service provider completes deprovisioning the circuit and notifies us.
  • 如果服务提供商已取消预配线路(服务提供商预配状态设置为“未预配” ),则可以删除线路。If the service provider has deprovisioned the circuit (the service provider provisioning state is set to Not provisioned), you can then delete the circuit. 这样就会停止对线路的计费。This stops billing for the circuit.

删除线路Delete a circuit

可以通过运行以下命令删除 ExpressRoute 线路:You can delete your ExpressRoute circuit by running the following command:

Remove-AzureDedicatedCircuit -ServiceKey "*********************************"