I'm using Packer with Azure in order to create custom image Linux ubuntu. The source image has been migreted from other subscription (zzzzz-zzzzz-zzzz-832e-zzzzzzzz) Azure which I don't have access ant put in my Gallery in subscription xxxxx-xxxxx-xxxx-8757-xxxxxx.
When trying to build, I'm getting the error:
Build 'azure-chroot' errored after 9 seconds 112 milliseconds: error attaching disk '/subscriptions/xxxxx-xxxxx-xxxx-8757-xxxxxx/resourceGroups/aaaaaa-DEVOPS-NEXTGEN-DEV-RG/providers/Microsoft.Compute/disks/PackerTemp-osdisk-1648023954': compute.VirtualMachinesClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: Code="LinkedAuthorizationFailed" Message="The client 'iiiiiiii-iiii-iii-9087-bd35be0485c3' with object id 'iiiiii-iiii-iiii-9087-bd35be0485c3' has permission to perform action 'Microsoft.Compute/virtualMachines/write' on scope '/subscriptions/xxxxx-xxxx-xxxx-8757-xxxxxxx/resourceGroups/UAI3042788-DEVOPS-NEXTGEN-DEV-RG/providers/Microsoft.Compute/virtualMachines/aaaaaaa-devops-nextgen-internal-dev-ubuntu-01-vm'; however, it does not have permission to perform action 'read' on the linked scope(s) '/subscriptions/zzzzz-zzzzz-zzzz-832e-zzzzzzzz/resourceGroups/aaaaaaa-ren-common-prod-rg/providers/Microsoft.Compute/galleries/RenewablesSharedImageGallery/images/ren-azure-ubuntu-december-2021' or the linked scope(s) are invalid."
My simple packer build file :
{
"builders": [{
"type": "azure-chroot",
"image_resource_id": "/subscriptions/subscription_id/resourceGroups/resource_group/providers/Microsoft.Compute/images/PEOSLinuxImage",
"source": "/subscriptions/xxxxx-xxxxx-xxxx-8757-xxxxxx/resourceGroups/aaaaaaa-devops-nextgen-dev-rg/providers/Microsoft.Compute/galleries/uai3042788nextgenImageGallery/images/
ren-azure-ubuntu/versions/1.0.03"
}],
"provisioners": [{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"inline": [
"apt-get update",
"apt-get upgrade -y",
"apt-get install openssh-server openssh-client -y"
],
"inline_shebang": "/bin/sh -x",
"type": "shell"
}]
}
Any help please?