Migrate to an availability zone-enabled ExpressRoute virtual network gateway using PowerShell

This article shows you how to migrate an ExpressRoute virtual network gateway from Standard, HighPerformance, or UltraPerformance SKUs to availability zone-enabled SKUs (ErGw1Az, ErGw2Az, ErGw3Az) using PowerShell. Higher-level SKUs provide more CPUs and network bandwidth, resulting in higher network throughput and more dependable connections to your virtual network.

Prerequisites

Before you begin, make sure you have:

Working with Azure PowerShell

The steps and examples in this article use Azure PowerShell Az modules. To install the Az modules locally on your computer, see Install Azure PowerShell. To learn more about the new Az module, see Introducing the new Azure PowerShell Az module. PowerShell cmdlets are updated frequently. If you are not running the latest version, the values specified in the instructions may fail. To find the installed versions of PowerShell on your system, use the Get-Module -ListAvailable Az cmdlet.

Migrate to a new gateway using PowerShell

The migration process uses PowerShell scripts to create a new gateway, transfer the configuration, and remove the old gateway.

Clone the migration scripts

  1. Clone the migration scripts from the Azure samples repository:

    git clone https://github.com/Azure-Samples/azure-docs-powershell-samples/ 
    
  2. Navigate to the ExpressRoute gateway migration directory:

    cd azure-docs-powershell-samples/expressroute-gateway/gateway-migration/
    

Prepare the migration

The PrepareMigration script creates a new ExpressRoute virtual network gateway on the same gateway subnet and connects it to your existing ExpressRoute circuits.

  1. Get the resource ID of your existing gateway:

    $resource = Get-AzResource -Name <gateway-name>
    $resource.Id
    

    Replace <gateway-name> with the name of your virtual network gateway.

  2. Run the PrepareMigration.ps1 script:

    .\PrepareMigration.ps1
    
  3. When prompted, enter the following information:

    • Resource ID of your gateway
    • Name suffix for your new resources (this name is appended to the existing name, for example: existingresourcename_newname)
    • Availability zone for your new gateway

Run the migration

The migration script transfers the configuration from the old gateway to the new gateway.

  1. Get the resource ID of your new gateway using the name you specified in the prepare step:

    $resource = Get-AzResource -Name <new-gateway-name>
    $resource.Id
    

    Replace <new-gateway-name> with the name of your new virtual network gateway.

  2. Run the Migration.ps1 script:

    .\Migration.ps1
    
  3. When prompted, enter the following information:

    • Resource ID of your original gateway
    • Resource ID of your new gateway

Commit the migration

The commit script removes the old gateway and its connections after you verify that the new gateway is working correctly.

Important

Before you run this step, verify that your new virtual network gateway has a working ExpressRoute connection. The migration process can cause a brief interruption of up to 30 seconds.

  1. Run the CommitMigration.ps1 script:

    .\CommitMigration.ps1
    
  2. When prompted, enter the resource ID of your original gateway.