# I would like to use my Hail Batch service account with Terra. How do I do that?

**URL:** <https://discuss.hail.is/t/i-would-like-to-use-my-hail-batch-service-account-with-terra-how-do-i-do-that/3066>\
**Category:** Hail Batch & General Cloud\
**Created:** [January 17, 2023, 10:51pm UTC](https://discuss.hail.is/t/i-would-like-to-use-my-hail-batch-service-account-with-terra-how-do-i-do-that/3066 "2023-01-17T22:51:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [January 17, 2023, 10:51pm UTC](https://discuss.hail.is/t/i-would-like-to-use-my-hail-batch-service-account-with-terra-how-do-i-do-that/3066/1 "2023-01-17T22:51:52Z")

</div>

I would like to use the Hail team’s hosted version of Hail Batch ([https://batch.hail.is](https://batch.hail.is)) with datasets stored in Terra. How do I do that?

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [January 17, 2023, 10:54pm UTC](https://discuss.hail.is/t/i-would-like-to-use-my-hail-batch-service-account-with-terra-how-do-i-do-that/3066/2 "2023-01-17T22:54:11Z")

</div>

Great question! First you must register your service account with Firecloud/Terra. You can do that using Hail Batch like this:

```python
import hailtop.batch as hb
b = hb.Batch(backend=hb.ServiceBackend(
    billing_project='YOUR_HAIL_BATCH_BILLING_PROJECT',
    remote_tmpdir='gs://YOUR_BUCKET/hail-batch-tmp'
))
j = b.new_job()
j.image('danking00/firecloud-tools:413.0.0-slim')
j.command('python3 /scripts/register_service_account/register_service_account.py -j $GOOGLE_APPLICATION_CREDENTIALS -e YOUR_BROAD_EMAIL')
b.run()

```

The job should run successfully and the output should look like:

```python
The service account dking-rew76@hail-vdc.iam.gserviceaccount.com is now registered with FireCloud. You can share workspaces with this address, or use it to call APIs.

```

Now you just need to grant permission for your service account to access the bucket containing the data of interest.
