diff --git a/Vertex_AI_Chat.ipynb b/Vertex_AI_Chat.ipynb index c18fcfe..4de9269 100644 --- a/Vertex_AI_Chat.ipynb +++ b/Vertex_AI_Chat.ipynb @@ -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}-compute@developer.gserviceaccount.com\" \\\n", + " --role=\"roles/aiplatform.user\" \\\n", + " --quiet\n", + "\n", + "print(\"☑️ Done\")" ] }, {