0

How can i create a dialogflow agent and associate it with the Google Cloud Console project i created and have it inherit all the team members i assigned to the project ? I am working on a dialogflow project. I created a new project in the Google Cloud Console and added some team members. However when i switch to the dialogflow console i do not see my project and the people i added to it. when i create a new agent in dialogflow it seems to have nothing to do with the project i created in the cloud console and i have to explicitly share the agent with the team. So the Google Cloud Console project is sort of useless. For example in Azure cognitive services i can link everything to my root project.

Best CK

cyran
  • 31
  • 5

1 Answers1

0

Google could do better in making these resources (e.g. Projects) more clear.

Actually (to my knowledge) all Google Projects represent the same underlying project resource and you can e.g. view DialogFlow projects from Google Cloud Console and vice versa.

I suspect (!) that you created 2 different projects: one using (Google Cloud Platform) Console and one using DialogFlow Console

If you have the Cloud SDK (aka gcloud) installed, you should be able to list all your projects (Cloud, DialogFlow etc.) using:

gcloud projects list

Now, to answer your question. Users of Google (!) Projects are Google accounts users and groups and also include service accounts. You may list the users for a given project with:

gcloud projects get-iam-policy ${PROJECT}

Ideally, what you want to do is ensure that this policy is reflected across both projects. I'm reluctant to provide a script because service accounts complicate this sharing. Service accounts work across projects but they are created automatically in projects. A simple copy-and-paste of accounts may break something for you.

That said, here's a gcloud command to enumerate the list of ${ROLE} (roles/owner) from one project ${SRC}:

PSRC=...
ROLE="roles/owner"
MEMBERS=$(gcloud projects get-iam-policy ${PSRC} \
--flatten=bindings \
--filter=bindings.role:${ROLE} \
--format="value(bindings.members)") && echo ${MEMBERS}

NB There's probably a way to split user:some@email.com if you need to

You could then iterate over this list and add (!) these accounts to ${PDST}

for MEMBER in ${MEMBERS}
do
  gcloud projects add-iam-policy-binding ${DST} \
  --member=${MEMBER} \
  --role=${ROLE}
done

Lastly, when you create a DialogFlow project you are provided with the option to use an existing Google (Cloud) Project. Next time, you follow this flow, please look for the "create new or use existing project" prompt. You would be able to select the Project you'd created previously to reuse your users.

halfer
  • 19,824
  • 17
  • 99
  • 186
DazWilkin
  • 32,823
  • 5
  • 47
  • 88