Create, change, or delete a Peering Service connection using the Azure CLI

Azure Peering Service is a networking service that enhances customer connectivity to Microsoft cloud services such as Microsoft 365, Dynamics 365, software as a service (SaaS) services, Azure, or any Microsoft services accessible via the public internet.

In this article, you'll learn how to create, change, and delete a Peering Service connection using the Azure CLI.

If you don't have an Azure subscription, create a free account before you begin.

If you decide to install and use Azure CLI locally, this article requires you to use version 2.0.28 or later of the Azure CLI. Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade. If using Azure Cloud Shell, the latest version is already installed.

Prerequisites

Register your subscription with the resource provider and feature flag

Before you proceed to the steps of creating the Peering Service connection, register your subscription with the resource provider and feature flag using az feature register and az provider register:

az feature register --namespace Microsoft.Peering --name AllowPeeringService
az provider register --name Microsoft.Peering

List Peering Service locations and service providers

Use az peering service country list to list the countries where Peering Service is available and az peering service location list to list the available metro locations in a specific country where you can get the Peering Service:

# List the countries available for Peering Service.
az peering service country list --out table
# List metro locations serviced in a country
az peering service location list --country "united states" --output table

Use az peering service provider list to get a list of available Peering Service providers:

az peering service provider list --output table

Create a Peering Service connection

Create a Peering Service connection using az peering service create:

az peering service create --location "eastus" --peering-service-name "myPeeringService" --resource-group "myResourceGroup" --peering-service-location "Virginia" --peering-service-provider "Contoso"

Add the Peering Service prefix

Use az peering service prefix create to add the prefix provided to you by the connectivity provider:

az peering service prefix create --peering-service-name "myPeeringService" --prefix-name "myPrefix" --resource-group "myResourceGroup" --peering-service-prefix-key "00000000-0000-0000-0000-000000000000" --prefix "240.0.0.0/32"

List all Peering Services connections

To view the list of all Peering Service connections, use az peering service list:

az peering service list --resource-group "myresourcegroup" --output "table"

List all Peering Service prefixes

To view the list of all Peering Service prefixes, use az peering service prefix list:

az peering service prefix list --peering-service-name "myPeeringService" --resource-group "myResourceGroup"

Remove the Peering Service prefix

To remove a Peering Service prefix, use az peering service prefix delete:

az peering service prefix delete --peering-service-name "myPeeringService" --prefix-name "myPrefix" --resource-group "myResourceGroup"

Delete a Peering Service connection

To delete a Peering Service connection, use az peering service delete:

az peering service delete --peering-service-name "myPeeringService" --resource-group "myResourceGroup"

Next steps