Skip to content

Commit

Permalink
add missing iam policy binding
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyclenerd committed Jan 15, 2024
1 parent 7865abc commit 956bccc
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions Vertex_AI_Chat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,38 @@
},
"outputs": [],
"source": [
"#@markdown #### Check authenticated user\n",
"#@markdown #### Check authenticated user and project\n",
"current_user = !gcloud auth list \\\n",
" --filter=\"status:ACTIVE\" \\\n",
" --format=\"value(account)\" \\\n",
" --quiet\n",
"\n",
"current_user = current_user[0]\n",
"print(f\"Current user: {current_user}\")"
"print(f\"Current user: {current_user}\")\n",
"\n",
"project_number = !gcloud projects list \\\n",
" --filter=\"projectId:{project_id}\" \\\n",
" --format=\"value(PROJECT_NUMBER)\" \\\n",
" --quiet\n",
"\n",
"project_number = project_number[0]\n",
"print(f\"Project number: {project_number}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@markdown #### Add IAM policy binding for default compute service account\n",
"\n",
"!gcloud projects add-iam-policy-binding \"{project_id}\" \\\n",
" --member=\"serviceAccount:{project_number}[email protected]\" \\\n",
" --role=\"roles/aiplatform.user\" \\\n",
" --quiet\n",
"\n",
"print(\"鈽戯笍 Done\")"
]
},
{
Expand Down

0 comments on commit 956bccc

Please sign in to comment.