Azure VM deployment across subscriptions and resource groups

Hello ansible gurus,

I’m trying to deploy a VM in Azure using the azure_rm_virtualmachine module, however, the resource group I’m creating the VM in is different from the resource group that contains my custom image. To further complicate matters, the resource groups are actually contained in separate subscription ids. My service principal has access to both subscriptions, but since I can only specify a single subscription id in the module, I’m unable to deploy the VM. Shouldn’t the option to deploy from a custom image in a different resource group also allow specifying a different subscription id?

I can successfully deploy a VM if both resource groups are in the same subscription id, but in my case they are not. I can also successfully deploy a VM using a json template with the Azure CLI, even though my resource groups are in separate subscriptions.

Another question I have about deploying VMs in Azure is the ability to use a Shared Image Gallery in Azure and deploy a VM using an image definition. From testing, it doesn’t look like the module supports a shared image gallery either, it is expecting the name of an image. Has anybody had success using ansible modules to deploy a VM from a shared image gallery?

This seems to be more about Azure behaviour than Ansible, and Azure write the Azure Ansible modules, I’d suggest asking them directly, you can get in touch with the Azure team at https://github.com/Azure/azure_modules because if I recall that module fronts ARM so its the underlying behaviour of ARM I’d be curious about.