Python Developer and Educator
2021-04-02
Once you're logged in to your Google account, you can list all of the projects you have access to, either with a personal account or within an organization, by visiting the Cloud Resource Manager page:
https://console.cloud.google.com/cloud-resource-manager
A Google Cloud Platform project can be created without adding any billing information - there is a lot of testing you can do with GCPs modules before cost kicks in. However if you do want to add an account to your project, you can find the billing setup at:
https://console.cloud.google.com/billing/linkedaccount
You can also navigate to this page from the home dashboard - Billing is at the top of the Products list. (To see this list, click on the hamburger menu in the upper lefthand corner to expand the Navigation menu.)
When you create a Google Cloud project, you are automatically an Owner on that project and have access to all of the active modules within it. You can add new modules, and you can also grant access to other users, through user accounts or service accounts.
As an example, BigQuery is the resource I grant permissions to most often, particularly when I'm collaborating with members of other teams on work that shares the same data source. In order to give a user access to BigQuery within a specific project, I might add that user to the project using their email address, then enable a combination of Roles for that user.
The most common combination of roles I grant for BigQuery access is:
For more information about BigQuery roles, visit:
https://cloud.google.com/bigquery/docs/access-control#bigquery
Definitions of all the roles available to users in Google Cloud can be found here:
https://cloud.google.com/iam/docs/understanding-roles
From your project's home dashboard, expand the Navigation menu and select `IAM & Admin`. That will take you to a page with a list of all the user/service accounts with access to your project.
Navigate to IAM & Admin and select the +ADD button at the top of the page. In the dialog pane that pops up, add the user's email address, then select Roles and save. Roles can also be modified later.
Individual user accounts can't access Google Cloud projects programmatically - to do that, you'll need to use a Service Account. A service account is a special kind of account used by an application to make authorized API calls.
Navigate to "Service Accounts" (under IAM & Admin) and select the CREATE NEW SERVICE ACCOUNT button at the top of the page. You'll be taken to a page that lets you set:
All three are arbitrary - what you choose to name a service account won't impact its functionality in any way. However, be aware that there is currently no way to associate a service account to specific activity in the GCP dashboard, so the name and description may be the only clue you have to how the service account is being used. Choose wisely, be as descriptive as possible.
Go the resource management page and select all the projects you want to manage:
https://console.cloud.google.com/cloud-resource-manager
If you're an owner on all of the projects you've selected, you'll see an 'Add Member' button that allows you to enter a voxmedia.com email address and select Roles that will be applied across all the selected projects.
You can also use the resource manager to remove a user from multiple projects at once, or to adjust a user's Roles across multiple projects in one step.
https://cloud.google.com/iam/docs/granting-changing-revoking-access
Navigate to IAM & Admin, find the account you want to modify and select Edit (the pencil icon on the right-hand side).
In the dialog pane that pops up, you'll see options for ADD ANOTHER ROLE or the trashcan icon to delete Roles.
In some cases, we've created service accounts for users within (or even outside) the organization, which they can use to gain access only to specific resources.
For example, to manage specific access to a service account on a BigQuery dataset:
https://cloud.google.com/bigquery/docs/dataset-access-controls#console
Managing access like this is slightly different for every resource type. For example, in Cloud Storage, you need to navigate to the bucket you want to manage, then go to the PERMISSIONS tab to add/remove/modify users.
Any time you're using the Google Cloud SDK (to use gcloud or bq tools locally) or requesting a Google Cloud resource programmatically, you need to have an environment variable set that points to a JSON credentials file from the project you're trying to access. This will be a credentials file associated with a specific service account.
To generate the file:
In your app, virtualenv, or server environment, set the environment variable with the path to the credentials file:
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/creds.json
Learn more about Google Cloud authentication here:
https://cloud.google.com/docs/authentication/getting-started
Contact: barbara@mechanicalgirl.com