Joey Yi Zhao
Joey Yi Zhao

Reputation: 42444

How can I add roles to service account in GCP?

I am using service account credential to deploy cloud function to GCP. I got a permission error:

Error: googleapi: Error 403: Missing necessary permission iam.serviceAccounts.actAs for $MEMBER on the service account

I open the service account permission in GCP but I can't find where I can add the role to the account.

Below is the screenshot of the service account. There is GRANT ACCESS button but it is used to grant member access to this account. How can I add roles on the role list?

enter image description here

Upvotes: 4

Views: 4227

Answers (2)

Erfa
Erfa

Reputation: 713

As of October 2023:

  1. Go to IAM & Admin -> IAM
  2. Under "View by principals" you will find all accounts, including service accounts
  3. Press the edit button on the right side of your service account
  4. Select "Add another roll" and add the role you want your service account to have

Upvotes: 1

Sergiusz
Sergiusz

Reputation: 1235

Recapping what John said:
You do not need to grant permissions to the Service Account.
You need to grant permission to user so that they can act as that Service Account.
TL;DR:
On the screen you provided, select Grant access, enter username and pick Service Account User role.

Upvotes: -1

Related Questions