We are using ARM templates to deploy components to customer tenants, and we would like to utilize a Shared Image Gallery in our management tenant to deploy virtual machines to customer tenants. I have successfully created a Shared Image Gallery, built a test image and version, deployed the VM using CLI and PowerShell but I’ve been unsuccessful in building an ARM template to do the same. Since our deployment system is based on ARM templates, I need to fine a way to deploy a VM from a SIG to another tenant.
I have a test service principal in both tenants, and I authenticate with both tenant prior to deploying the ARM template. I know the security is correct as it’s successful using PowerShell or CLI.
The shared image gallery image is referenced from the ARM template:
"storageProfile": {
"imageReference": {
"id": "/subscriptions/<sourceSubscriptionID>/resourceGroups/<sourceResourceGroupName>/providers/Microsoft.Compute/galleries/<sourceGalleryName>/images/<sourceImageName>/versions/<sourceVersion>"
},
When I deploy this ARM template, the error message is as follows:
The client has permission to perform action 'Microsoft.Compute/galleries/images/versions/read' on scope '/subscriptions/<targetSubscriptionId>/resourcegroups/<targetResourceGroupName>/providers/Microsoft.Compute/virtualMachines/<newVMName>', however the current tenant <sourceTenantId> is not authorized to access linked subscription <sourceSubscriptionID>."
Is this possible with ARM? Has anyone seen samples on how to accomplish this by using ARM templates?
Most of my research is based on the MS article:
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/share-images-across-tenants
Has anyone been successful deploying a SIG image through a ARM template?
Mitch