Can we trigger Dataflow job(Apache beam) using template of project B from project A in GCP

I am facing one issue and need help for the same. It's related to GCP dataflow(apache beam).

I have a dataflow template created in project B and everything works if I run it in Project B either using a person's email or service account.

I am looking for a solution to run(trigger) the dataflow template of project B from some other project A using a service account of project A which will have all the permission in project B.

Already Tried:

  • I triggered it using gcloud command as below

gcloud dataflow jobs run BigQueryToBigQuery \ --gcs-location gs://{GCS bucket}/templates/BigQueryToBigQuery \ --parameters query=bigQueryTableName={projectID}:{dataset}.{table} --region=us-east1

Here gcs-location used is the location of the template present in project B.

When I use a service account of project A, it triggers Job in project A, not in project B and when I run(trigger) it using Project B's service account it gives generic error Current user cannot act as service account... the expectation is to trigger it on project B.

Any help will be appreciated