GCP IAM Permissions: Update and Manage User Permissions
Learn how to use the Google Cloud CLI to script tasks like assigning roles to a new user and adding them to a group.
Learn how to use the Google Cloud CLI to script tasks like assigning roles to a new user and adding them to a group.
Google Cloud uses an Identity and Access Management (IAM) system to provide access to resources within the environment. With IAM roles and groups, you can provide users with granular access to resources while using the principle of least privilege to prevent anyone from gaining unnecessary permissions.
In this guide, we’ll cover the basics of roles and groups, and how you can use the Google Cloud CLI to make updates to each.
IAM doesn’t grant permissions to individual users to access resources. Instead, users get assigned to a role. Roles contain permissions that allow users to perform specific actions on resources within Google Cloud. The three types of roles available within IAM include:
You can define and adjust roles using IAM policies. In a future post, we’ll explain how to make those updates. In this guide, we’ll assume you already have some roles set up, and we’ll show how to assign roles to users directly and through groups.
Before creating a new IAM user, that person must have an existing Google email address. Once a user has created a Google account, you can grant them permissions by assigning them to a role using the following syntax within the GCloud CLI:
Below are definitions for the parameters in the above command:
Here’s an example of adding a user to a project as a config editor:
Below is an example of the syntax to use if you wish to remove that role from a user:
While you can assign roles to individual users, groups are a way for Admins to extend standard roles and access to resources to a team or project group. Every member of a Google group inherits its IAM roles.
For example, if an “editor” role for a certain scope of resources is granted to a group, then any user who is added to that group will assume that role of “editor” and have editor permissions for those resources.
You can add members to an existing Google Cloud Group using the “add” command within the GCloud CLI:
The below flags are required:
You can also add the following optional flags:
Inversely, you can remove members from groups using the “delete” command:
Most likely, as your organization grows, changing and updating permissions and policies will take up more time. Instead of having to look up the specific command for each of these actions, you could use a low-code tool like Blink to handle tasks like this in a couple clicks.
Get started with Blink today to see how easy automation can be.
Blink is secure, decentralized, and cloud-native. Get modern cloud and security operations today.