How to specify a virtual network in a different resource group when creating a new Azure VM?

Hi,

I am trying to create a VM in Azure using Ansible. The setup of our Azure configuration is that the virtual network is created in a different resource manager from the virtual machines’. When I using azure_rm_virtualmachine module to create a virtual machine in Azure, the module complains that the virtual network does not exist in the resource manager of the virtual machine to be created. Is there any way I can do that? Can I specify a virtual network with a fully qualified name including its resource manager name so that the module would not confuse it with the resource manager of the virtual machine?

Vincent

I know I tested this back when we first wrote it, so unless it got broken along the way somewhere, if you pass the full resource URI for the vnet (regardless of whether or not it’s in the same RG), it should do the right thing…

Hi,

I am facing the same issue, did you manage to get down to the bottom of this. I am having no luck so far.

Cheers
Bamar

I tried with full URI and no luck.

virtual_network_name: /subscriptions/<Subscriptions_ID>/resourceGroups/<Resource_Group>/providers/Microsoft.Network/virtualNetworks/ansible_test

Anyone help on this pls ?