Skip to content

Creating a VXC between an MCR and Microsoft Azure with the API

This topic steps through the API procedure to create a VXC from an MCR to Microsoft Azure ExpressRoute, including how to look up Azure interconnect locations and order VXCs.

The MCR to Azure deployment includes these tasks:

  1. Set up an ExpressRoute circuit in the Azure console

    When deployed, you get a service key. When you validate a service key, you are presented with primary and secondary ports and can choose the port for the connection. You can use the key a second time and create another connection to the unused port.

    For more information, see the Microsoft help topic Tutorial: Create and modify an ExpressRoute circuit.

  2. With the service key, create and deploy a VXC

    As part of the VXC configuration, you can choose the peering type.

    The peering type can be either private or Microsoft.

    A defined peering type results in automatically configured peering with peers matched on both the Azure and Megaport sides and a deployed system with a known working configuration. You can modify the configuration once deployed.

Before you begin, obtain a valid access token. For more information, see Creating an API Key.

Validate the service key

When you use the API to validate an Azure service key, the response includes ExpressRoute details of the associated ports and peers. You need the port details to create the VXCs.

To validate the service key in the Postman collection

  1. In Postman, expand Cloud Connectivity > MCR > Azure in the left navigation and select GET Look Up Azure Service Key.

  2. Add the service key to the endpoint.

  3. Click Send to make a GET request to the API server.

    GET {baseUrl}/v2/secure/azure/{service_key}
    

Here is a sample response for a new key (without configured VXCs):

{
    "message": "Successful lookup",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": {
        "managed": false,
        "connectType": "AZURE",
        "resource_type": "csp_connection",
        "bandwidth": 200,
        "service_key": "3e2480b2-b4d5-424b-976a-7b0de65a1b62",
        "vlan": 3289,
        "megaports": [
            {
                "portSpeed": 10000,
                "name": "Washington DC Primary",
                "state": "VA",
                "description": "Azure ExpressRoute at Equinix DC2/6",
                "productUid": "a7ae8a35-433e-44aa-87cb-a1b7995ab008",
                "nServiceId": 32832,
                "companyUid": "c40de5ed-4707-4471-a78c-69436de2c505",
                "country": "USA",
                "vxc": null,
                "port": 14570,
                "companyName": "Azure ExpressRoute",
                "locationId": 67,
                "productId": 14570,
                "type": "primary",
                "companyId": 1475
            },
            {
                "portSpeed": 10000,
                "name": "Washington DC Secondary",
                "state": "VA",
                "description": "Azure ExpressRoute at Equinix DC2/6",
                "productUid": "07ab0ee6-7f77-41ac-bbe6-335e3ee6d182",
                "nServiceId": 36431,
                "companyUid": "c40de5ed-4707-4471-a78c-69436de2c505",
                "country": "USA",
                "vxc": null,
                "port": 16108,
                "companyName": "Azure ExpressRoute",
                "locationId": 67,
                "productId": 16108,
                "type": "secondary",
                "companyId": 1475
            }
        ],
        "peers": []
    }
}

For more information about each response field, see Azure Service Key Response Fields.

Ordering a VXC with peering options

With the details from the service key, create a VXC to the primary port and another VXC to the secondary port. Make sure that you select an MCR in the same region as the Azure ports from the service key lookup request.

If you specify the peering type in the API request for the VXC, Megaport will set up the IP addressing and BGP details on both the MCR and the Azure side to ensure a working BGP setup.

To specify the peering type, add a peering type to the peers array in the partnerConfig section. If a peers array does not exist, peers are retrieved from Azure. If peers are not specified when creating the VXC and there are no peers in Azure (which is normally the case for new service keys), the MCR peering will not be autoconfigured.

The MCR creates a VLAN for each configured peering type. If both private and Microsoft peering options are specified, the MCR configures two inner VLANs.

Note

The peering types are remembered and cannot be changed if a key has been previously used.

To create the VXC

  1. Create a request with the POST Create VXC to Azure (v3) endpoint:

    POST {baseUrl}/v3/networkdesign/buy
    

    Tip

    To test your request before you order, you can use: POST {baseUrl}/v3/networkdesign/validate

  2. Update the Body of the request with the productUid of the MCR, the name of the VXC, the productUid of the Azure port, and the service key. Include the appropriate peering option. The maximum speed (rateLimit) is defined in the bandwidth value of the service key response. In this case, it is 200.

    The Azure VLAN (if specified) is the outer tag VLAN for Q-in-Q. If you don’t specify the VLAN, it will be autoprovisioned.

To use an Azure key with private peering option, use this template:

 [
     {
        "productUid": "{{mcrid}}",
        "associatedVxcs": [
            {
                "productName": "Azure Primary VXC",
                "rateLimit": 200,
                "term": 12,
                "shutdown": false,
                "aEnd": {
                    "vlan": 0
                },
                "bEnd": {
                    "productUid": "{{azurepuid}}",
                    "vlan": "{{azurevlan}}",
                    "partnerConfig" : {
                        "connectType": "AZURE",
                        "serviceKey": "{{azurekey}}",
                        "peers": [{"type": "private"}]
                    }
                }
            }
        ]
    }
]

For Microsoft peering, use this line for the peers:

          "peers":[{"type":"microsoft"}]

For both Microsoft and private peering, use this line:

          "peers":[{"type":"microsoft"}, {"type": "private"}]

After you create a VXC for the primary Azure port, create another VXC to connect to the productUid of the secondary Azure port (change the productName and the bEnd: productUid).

Configured response

When you create the VXCs with peering, another service key validation request displays the full configuration.

{
    "message": "Successful lookup",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": {
        "managed": true,
        "connectType": "AZURE",
        "resource_type": "csp_connection",
        "bandwidth": 200,
        "service_key": "3e2480b2-b4d5-424b-976a-7b0de65a1b62",
        "vlan": 3289,
        "megaports": [
            {
                "portSpeed": 10000,
                "name": "Washington DC Primary",
                "state": "VA",
                "description": "Azure ExpressRoute at Equinix DC2/6",
                "productUid": "a7ae8a35-433e-44aa-87cb-a1b7995ab008",
                "nServiceId": 32832,
                "companyUid": "c40de5ed-4707-4471-a78c-69436de2c505",
                "country": "USA",
                "vxc": 60574,
                "port": 14570,
                "companyName": "Azure ExpressRoute",
                "locationId": 67,
                "productId": 14570,
                "type": "primary",
                "companyId": 1475
            },
            {
                "portSpeed": 10000,
                "name": "Washington DC Secondary",
                "state": "VA",
                "description": "Azure ExpressRoute at Equinix DC2/6",
                "productUid": "07ab0ee6-7f77-41ac-bbe6-335e3ee6d182",
                "nServiceId": 36431,
                "companyUid": "c40de5ed-4707-4471-a78c-69436de2c505",
                "country": "USA",
                "vxc": 60575,
                "port": 16108,
                "companyName": "Azure ExpressRoute",
                "locationId": 67,
                "productId": 16108,
                "type": "secondary",
                "companyId": 1475
            }
        ],
        "peers": [
            {
                "peer_asn": 133937,
                "shared_key": null,
                "primary_subnet": "169.254.167.176/30",
                "secondary_subnet": "169.254.167.180/30",
                "vlan": 100,
                "type": "private"
            },
            {
                "peer_asn": 133937,
                "shared_key": null,
                "prefixes": "117.18.81.116/30,117.18.81.120/30",
                "primary_subnet": "117.18.81.116/30",
                "secondary_subnet": "117.18.81.120/30",
                "vlan": 200,
                "type": "microsoft"
            }
        ]
    }
}

Last update: 2024-04-15