Muokkaa

Jaa


Convert a legacy Exchange peering to an Azure resource using PowerShell

This article describes how to convert an existing legacy Exchange peering to an Azure resource by using PowerShell cmdlets.

If you prefer, you can complete this guide by using the Azure portal.

Before you begin

Work with Azure PowerShell

To run the cmdlets, you can use Azure Cloud Shell, a free interactive shell. It has common Azure tools preinstalled and configured to use with your account. Select Copy to copy the code, and paste it into Cloud Shell. Then select Enter to run it. There are a few ways to launch Cloud Shell:

Launch Method Screenshot
Open Cloud Shell in your browser. https://shell.azure.com/powershell
Select the Cloud Shell button on the toolbar in the upper right of the Azure portal. Cloud Shell in the portal

If you don't want to use Azure Cloud Shell, you can install PowerShell locally instead. If you choose to install and use PowerShell locally, be sure to install the latest version of the Azure Resource Manager PowerShell cmdlets. PowerShell cmdlets are updated frequently. You typically need to update your PowerShell cmdlets to get the latest feature functionality. If you don't, you might encounter issues.

To find the version of PowerShell that you're running locally, use the 'Get-Module -ListAvailable Az' cmdlet. To update, see Install the Azure PowerShell module. For more information, see how to install and configure Azure PowerShell.

If you use PowerShell on macOS, follow the steps in Installing PowerShell on macOS.

Convert a legacy Exchange peering to an Azure resource

Sign in to your Azure account and select your subscription

Before you begin configuration, install and import the required modules. You need Administrator privileges to install modules in PowerShell.

  1. Install and import the Az module.

    Install-Module Az -AllowClobber
    Import-Module Az
    
  2. Install and import the Az.Peering module.

    Install-Module -Name Az.Peering -AllowClobber
    Import-Module Az.Peering
    
  3. Verify that the modules imported properly by using this command:

    Get-Module
    
  4. Sign in to your Azure account by using this command:

    Connect-AzAccount
    
  5. Check the subscriptions for the account, and select the subscription in which you want to create a peering.

    Get-AzSubscription
    Select-AzSubscription -SubscriptionId "subscription-id"
    
  6. If you don't already have a resource group, you must create one before you create a peering. You can do so by running the following command:

    New-AzResourceGroup -Name "PeeringResourceGroup" -Location "Central US"
    

Important

If you haven't already associated your ASN and subscription, follow the steps in Associate Peer ASN. This action is required to request a peering.

Note

The location of a resource group is independent of the location where you choose to set up a peering.  

Get legacy Exchange peering for conversion

This example shows how to get legacy Exchange peering at the Seattle peering location:

$legacyPeering = Get-AzLegacyPeering -Kind Exchange -PeeringLocation "Seattle"
$legacyPeering

The response looks similar to the following example:

    Kind                     : Exchange
    PeeringLocation          : Seattle
    PeerAsn                  : 65000
    Connection               : ------------------------
    PeerSessionIPv4Address   : 10.21.31.100
    MicrosoftIPv4Address     : 10.21.31.50
    SessionStateV4           : Established
    MaxPrefixesAdvertisedV4  : 20000
    PeerSessionIPv6Address   : fe01::3e:100
    MicrosoftIPv6Address     : fe01::3e:50
    SessionStateV6           : Established
    MaxPrefixesAdvertisedV6  : 2000
    ConnectionState          : Active

Convert legacy peering

This command can be used to convert legacy Exchange peering to an Azure resource:

$legacyPeering[0] | New-AzPeering `
    -Name "SeattleExchangePeering" `
    -ResourceGroupName "PeeringResourceGroup"

 

Important

When you convert legacy peering to an Azure resource, modifications aren't supported.  

This example response shows when the end-to-end provisioning was successfully completed:

    Name                     : SeattleExchangePeering
    Kind                     : Exchange
    Sku                      : Basic_Exchange_Free
    PeeringLocation          : Seattle
    PeerAsn                  : 65000
    Connection               : ------------------------
    PeerSessionIPv4Address   : 10.21.31.100
    MicrosoftIPv4Address     : 10.21.31.50
    SessionStateV4           : Established
    MaxPrefixesAdvertisedV4  : 20000
    PeerSessionIPv6Address   : fe01::3e:100
    MicrosoftIPv6Address     : fe01::3e:50
    SessionStateV6           : Established
    MaxPrefixesAdvertisedV6  : 2000
    ConnectionState          : Active

Additional resources

You can get detailed descriptions of all the parameters by running the following command:

Get-Help Get-AzPeering -detailed

Next steps