Building an Azure image with a base image hosted in another Azure tenant

I am trying to use packer to create a new image in tenant 2 which is based on an image hosted in a shared image gallery in tenant 1. According to Share gallery images across tenants - Azure Virtual Machines | Microsoft Docs, it is possible to do this with raw VMs, but I can’t get it to work with packer. I’m trying to make this work with use_azure_cli_auth: true then logging into two service principals like in the VM example. It doesn’t seem to work though. If I set the active subscription to tenant 1 before running packer, I get an error like Cannot find an image named 'myimage' in the resource group 'myresourcegroup'. If I try setting the active subscription to tenant 2, I get an error like 2021-06-01T15:47:13-05:00: Build 'azure-arm' errored after 4 seconds 747 milliseconds: compute.ImagesClient#ListByResourceGroup: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ResourceGroupNotFound" Message="Resource group 'myresourcegroup' could not be found."

Any idea what I am doing wrong here? Is this setup supported/expected to work?