I would like to know is there any way to get group ids either using CLI or Cloud console? Using this id, I need to collect the members list using Cloud API. I was going through google documentation but I couldn't find it.
For example if I use:
gcloud identity groups memberships list --group-email=abc@xyz.com
It gives the group id. Then I am using this doc to get the list of members.
If using Google's SDK tool gcloud
is ok with you then you can do it as follows:
Group's ID is it's actual email address - you can see it below:
wb@cloudshell:~ $ gcloud identity groups describe esa111@google.com
createTime: '2021-10-12T09:13:16.737141Z'
description: test group
displayName: esa111
groupKey:
id: esa111@google.com
labels:
cloudidentity.googleapis.com/groups.discussion_forum: ''
name: groups/00rj4333f0glbwez
parent: customers/Cx2hsdde9nw
updateTime: '2021-10-12T09:13:16.737141Z'
To get a members list:
wb@cloudshell:~ $ gcloud identity groups memberships list --group-email=esa111@google.com
---
name: groups/00rj4333f0glbwez/memberships/129543432329845052
preferredMemberKey:
id: esa222@google.com
roles:
- name: MEMBER
---
name: groups/00rj4333f0glbwez/memberships/11674834e3327905886
preferredMemberKey:
id: esa111@google.com
roles:
- name: OWNER
- name: MEMBER
And to have just group's members ID's listed use grep
and you'll get:
wb@cloudshell:~ $ gcloud identity groups memberships list --group-email=esa111@google.com | grep id:
id: esa222@google.com
id: esa111@google.com
Here's some docs on the gcloud identity groups describe
and list
commands.