Enable Azure Peering Service on a Direct peering using PowerShell

This article describes how to enable Azure Peering Service on a Direct peering by using PowerShell cmdlets and the Azure Resource Manager deployment model.

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.

Enable Peering Service on a Direct peering

View Direct peering

To get the list of peerings, run the Get-AzPeering command.

$directPeering = Get-AzPeering -ResourceGroupName "PeeringResourceGroup" -Name "SeattleDirectPeering"

The following example shows the response when end-to-end provisioning was successfully completed.

    Name                 : SeattleDirectPeering
    Sku.Name             : Basic_Direct_Free
    Kind                 : Direct
    Connections          : {71}
    PeerAsn.Id           : /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/SeattleDirectPeering
    UseForPeeringService : False
    PeeringLocation      : Seattle
    ProvisioningState    : Succeeded
    Location             : centralus
    Id                   : /subscriptions/{subscriptionId}/resourceGroups/PeeringResourceGroup/providers/Microsoft.Peering/peerings/SeattleDirectPeering
    Type                 : Microsoft.Peering/peerings
    Tags                 : {}

Enable the Direct peering for Peering Service

After you get Direct peering in the previous step, enable it for Peering Service.

  1. View connections on the selected Direct peering.

    $directPeering.Connections
    
    PeeringDBFacilityId         : 6
    UseForPeeringService        : False
    SessionAddressProvider      : Peer
    SessionPrefixV4             : 12.245.179.20/30
    ConnectionIdentifier        : 3f196dfe-c174-4900-ab1c-fb7b50ad1535
    SessionPrefixV6             :
    MicrosoftSessionIPv4Address : 12.245.179.22
    BandwidthInMbps             : 100000
    SessionStateV4              : Established
    SessionStateV6              : None
    ConnectionState             : Active
    
  2. Select the connection you want to enable for Peering Service. For this example, we'll use the only connection available.

    $directPeering.Connections[1] = $directPeering.Connections[1] | Set-AzPeeringDirectConnectionObject -UseForPeeringService $true
    
    PeeringDBFacilityId         : 6
    UseForPeeringService        : True
    SessionAddressProvider      : Peer
    SessionPrefixV4             : 12.245.179.20/30
    ConnectionIdentifier        : 3f196dfe-c174-4900-ab1c-fb7b50ad1535
    SessionPrefixV6             :
    MicrosoftSessionIPv4Address : 12.245.179.22
    BandwidthInMbps             : 100000
    SessionStateV4              : Established
    SessionStateV6              : None
    ConnectionState             : Active
    
  3. Now save the changes made to the Direct peering by using this command:

    $directPeering | Update-AzPeering
    

    Here's a sample output:

        Name                 : SeattleDirectPeering
        Sku.Name             : Basic_Premium_Free
        Kind                 : Direct
        Connections          : {71,71}
        PeerAsn.Id           : /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/SeattleDirectPeering
        UseForPeeringService : True
        PeeringLocation      : Seattle
        ProvisioningState    : Succeeded
        Location             : centralus
        Id                   : /subscriptions/{subscriptionId}/resourceGroups/PeeringResourceGroup/providers/Microsoft.Peering/peerings/SeattleDirectPeering
        Type                 : Microsoft.Peering/peerings
        Tags                 : {}
    

Modify a Direct peering connection

If you need to modify connection settings, see the "Modify a Direct peering" section in Create or modify a Direct peering by using PowerShell.

Next steps

Additional resources

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

Get-Help Get-AzPeering -detailed

For frequently asked questions, see the Peering Service FAQ.