I have heard some organizations complaining that deploying a fully functional ExpressRoute circuit takes too long: days, or even weeks. Does this always have to be like that?
I recently got access to Megaport‘s service portal: Megaport is one of Azure ExpressRoute providers, and they can provision virtual routers dynamically and connect them to Azure ExpressRoute private and Microsoft peerings. Additionally, the Megaport API allows to interact with the services programmatically to deploy them, modify them and delete them. So here is the question: would I be able to code a script that deploys an Azure environment end to end, including ExpressRoute connectivity, in under 1 hour?
The first step was creating some code to interact with the Megaport API. I decided to use curl as my client, because you can easily use it in bash scripts together with the Azure CLI. And here the result: megaport.sh. Essentially a wrapper for the Megaport API that allows to login to the Megaport API using credentials stored in Azure Key Vault, create Megaport Cloud Routers, connect them to Azure ExpressRoute, and delete them when they are no longer needed.
Once that script was ready, I only needed to create some Azure resources, and plumb everything together. My main goal here is automating the creation of testbeds with which I can test and debug ExpressRoute designs, for which I need to simulate an on-premises network. I do that by connecting a second circuit to the Megaport Cloud Router, in a topology similar to this one:
Obviously, a production setup would look like different to the diagram above, that is just my ExpressRoute testbed creation script.
And the resulting script is not too complex, you can see the final result here: expressroute.azcli. If you look at the script commands, the most time-consuming activity is creating the Azure ExpressRoute gateways, which can take around half an hour. The whole script runs unattended without any user input or click, so you can start it, go have lunch, and you will find a fully functional ExpressRoute environment when you come back.
Thanks to Megaport for showing how easy Azure ExpressRoute can be!