In case if you're developing your infrastructure as a code with Terraform and you need to connect your Azure VMware Solution (AVS) cluster to the Virtual WAN hub using ExpressRoute connection, you can follow the steps described in this article.
Prerequisites
You need to have:
- Deployed AVS cluster
- Deployed Azure Virtual WAN
- Deployed Azure Virtual WAN Hub
In case you also want to declare these resources in your code (which in most cases you do), then here are the examples of their definition:
For convenience, the sample code is split into three files. In the first one, we declare the variables we will use further, next declare local definitions of the object names and then declare all resources related to Virtual WAN.
By default, the virtual hub router is automatically configured to deploy with a virtual hub capacity of 2 routing infrastructure units. This supports a minimum of 3 Gbps aggregate throughput, and 2000 connected VMs deployed in all virtual networks connected to that virtual hub.
If you want to change the performance of the vWAN Hub, you can add a virtual_router_auto_scale_min_capacity
parameter to the Hub definition. For supported values please refer to the Azure Virtual Hub settings documentation.
Add an ExpressRoute gateway instance
To connect the AVS cluster to vWAN, you will need an ExpressRoute gateway instance.
Let's add an ExR Gateway definition to the vwan.tf
file:
Same as for vWAN Hub, the ExpressRoute gateway has its performance parameter called scale_units
. To learn more about the ExR Gateway scale units, please refer to the ExpressRoute Gateway performance in Virtual WAN documentation.
Obtain AVS ExpressRoute peering ID
Before we can proceed and declare the connection resource, first we need to get the AVS ExR private peering ID. In my case, the AVS cluster was deployed as a separate project, so there's no AVS cluster resource definition. Thus you can use the data
resource to get it. Add a few more variables to the variables.tf
that will describe where the AVS cluster is deployed and what's its name:
Now create another file named avs.tf
and add the data resource:
Generate ExR authorization key
As stated earlier, in my case the AVS cluster was deployed separately, therefore another step has to be done - is to request an ExpressRoute authorization key. This key is then used as a parameter in the ExpressRoute connection resource.
If you're deploying vWAN and AVS cluster altogether, you can declare a azurerm_vmware_express_route_authorization
resource the required number of times to get authorization keys.
You can ask a person responsible for AVS cluster administration to generate that key for you. Or, if you have enough privileges, generate such a key yourself. To do that:
- proceed to the Azure Portal
- in the search bar type
avs
- click on the Azure VMware Solution item
- you should see the list of available AVS clusters (if not, verify you have the right subscription selected)
- click on the target cluster from the list
- on the left pane click on Manage > Connectivity and then
- select the ExpressRoute in the middle pane
- click on Request an Authorization key
- enter the recognizable name for the key (it could be the name of your vWAN Hub for example)
- click on the Create button and wait until the key is generated
The key will be displayed in the middle pane in a Name/Key table.
Add an authorization key variable and the ExR connection name to the variables.tf
:
Declare ExR connection
Head to the vwan.tf
file and add the next lines:
This way we declared the ExpressRoute connection from vWAN Hub (ExR Gateway) to the AVS cluster.
Create resources
Run terrafrom apply
to calculate the differences and create the required resources.