How to use Shared image gallery on different subscription - Azure Devops

Hello. Can anybody tell me how to use a shared image gallery on subscription A, to deploy VMs through azure devops pipelines on subscription B.

I created the shared image gallery on subscription B and of course was able to deploy the VMs, But we have several subscription and we dont want to create and maintain shared image galleries on each subscription, instead we want to use a single shared image gallery on Subscription A.

When deploying terraform on azure devops, I create a service connection to the subscription and of course I cannot reference the shared image gallery on different subscription so I’m wondering how to simplify this situation.

Please confirm.