Associate peer ASN to Azure subscription using PowerShell
Before you submit a peering request, you should first associate your ASN with Azure subscription using the steps below.
If you prefer, you can complete this guide using the Azure portal.
Working 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. | ![]() |
Select the Cloud Shell button on the toolbar in the upper right of the Azure 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.
Create PeerASN to associate your ASN with Azure Subscription
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.
Install and import the Az module.
Install-Module Az -AllowClobber Import-Module Az
Install and import the Az.Peering module.
Install-Module -Name Az.Peering -AllowClobber Import-Module Az.Peering
Verify that the modules imported properly by using this command:
Get-Module
Sign in to your Azure account by using this command:
Connect-AzAccount
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"
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.
Register for peering resource provider
Register for peering resource provider in your subscription using the command below. If you don't execute this, then Azure resources required to set up peering aren't accessible.
Register-AzResourceProvider -ProviderNamespace Microsoft.Peering
You can check the registration status using the commands below:
Get-AzResourceProvider -ProviderNamespace Microsoft.Peering
Important
Wait for RegistrationState to turn "Registered" before proceeding. It may take 5 to 30 minutes after you execute the command.
Update the peer information associated with this subscription
Below is an example to update peer information.
New-AzPeerAsn `
-Name "Contoso_1234" `
-PeerName "Contoso" `
-PeerAsn 1234 `
-Email noc@contoso.com, support@contoso.com `
-Phone "+1 (555) 555-5555"
Note
-Name corresponds to resource name and can be anything you choose. However, -peerName corresponds to your company's name and needs to be as close as possible to your PeeringDB profile. Note that value for -peerName supports only characters a-z, A-Z, and space.
A subscription can have multiple ASNs. Update the peering information for each ASN. Ensure that "name" is unique for each ASN.
Peers are expected to have a complete and up-to-date profile on PeeringDB. We use this information during registration to validate the peer's details such as NOC information, technical contact information, and their presence at the peering facilities etc.
Note that in place of {subscriptionId} in the output above, actual subscription ID will be displayed.
View status of a PeerASN
Check for ASN Validation state using the command below:
Get-AzPeerAsn
Below is an example response:
PeerContactInfo : Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.PSContactInfo
PeerName : Contoso
ValidationState : Approved
PeerAsnProperty : 1234
Name : Contoso_1234
Id : /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/Contoso_1234
Type : Microsoft.Peering/peerAsns
Important
Wait for the ValidationState to turn "Approved" before submitting a peering request. It may take up to 12 hours for this approval.
Modify PeerAsn
You may modify NOC contact information anytime.
Below is an example:
Set-PeerAsn -Name Contoso_1234 -Email "newemail@test.com" -Phone "1800-000-0000"
Delete PeerAsn
Deleting a PeerASN isn't currently supported. If you need to delete PeerASN, contact Microsoft peering.
Next steps
- Create or modify a Direct peering
- Convert a legacy Direct peering to Azure resource
- Create or modify Exchange peering
- Convert a legacy Exchange peering to Azure resource
Additional resources
For more information, visit Internet peering FAQs
Feedback
Submit and view feedback for