Get authenticated user from Vertex AI notebook

94 Views Asked by At

is there any way to get the user name who is currently in the Vertex AI Notebook?

For example in Vertex AI Notebok if I do this:

$ curl "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/email" -H "Metadata-Flavor: Google"

I get: [email protected]

Or if I do this using Python:

import os
user = os.environ.get("USER")
print(f"USER = {user}")

I get: USER = jupyter

So I expect to get something like this: my_gcp_user@my_domain.com

0

There are 0 best solutions below