Search code examples
google-cloud-platformgmailpublish-subscribe

GCP - Pub/Sub Add Principal failed - [email protected]


I'm trying to use Pub/Sub and Gmail API to trigger events based on emails, but I'm having trouble adding principals in Pub/Sub.

When trying to register with the following details:

I encounter the following error and cannot proceed.

The 'Domain Restricted Sharing' organization policy (constraints/iam.allowedPolicyMemberDomains) is enforced. Only principals in allowed domains can be added as principals in the policy. Correct the principal emails and try again.

I'm totally stuck,I need your help, please.

Add Principal Images

I have checked the organization's policy 'constraints/iam.allowedPolicyMemberDomains'.

Check Policy Images


Solution

  • To change the 'Domain Restricted Sharing' organization policy (constraints/iam.allowedPolicyMemberDomains), the account must have the Organization Policy Administrator role. After granting the necessary permissions, changing the 'Domain Restricted Sharing' organization policy rule to "Allow all" resolved the above error.

    1.Grant the "Organization Policy Administrator" role to the account in "IAM". 1

    2.Change the 'Domain Restricted Sharing' in "Organization Policy". 2 3