Another tool that can be used when managing networks is the Azure CLI. With the Azure CLI, you can basically do everything you could do using the Azure portal, but this time using a more robust and automation-friendly tool that can be run on any platform.
To create a peering with the CLI, you will need to use the following command:
az network vnet peering create [-h] [--verbose] [--debug] [--output {json,jsonc,table,tsv}] [--query JMESPATH] --resource-group RESOURCE_GROUP_NAME --vnet-name NAME --name VIRTUAL_NETWORK_PEERING_NAME --remote-vnet-id REMOTE_VIRTUAL_NETWORK [--allow-vnet-access] [--allow-forwarded-traffic] [--allow-gateway-transit] [--use-remote-gateways] [--subscription _SUBSCRIPTION]
The command is structured in a way that helps us understand its particular steps. This is why it contains the main category (network), service (vnet), feature (peering), and action (create). While it is quite rich, you will actually only need four parameters:
- Resource...