> Documentation index for agents: /hcp/3.3/en/llms.txt

# Assign a role

Assign a role to give a user permissions: for the whole cluster or in one VDC (virtual data center). For how roles and scopes relate to each other, see [Roles and access](/hcp/3.3/en/users/index.md).

## Before you begin

- You need the **Cluster master** role or a custom role with the **Assign User Role** privilege.
- The user exists — [Create a user and set a password](/hcp/3.3/en/users/create-user/index.md). Roles cannot be assigned to the built-in `superadmin` account.
- The role is chosen: built-in or custom — [Create a custom role](/hcp/3.3/en/users/create-role/index.md).
- For a role in a VDC, the VDC already exists — [Create a VDC](/hcp/3.3/en/vdcs/create-vdc/index.md).

## Assign the role

1. In the left menu, select **Provider Data Center** → **Users & Roles**.

2. Click the user row in the table on the **Users** tab. The user page opens.

3. Select **Actions** → **Assign a role**. The **Are you sure want to assign a role to user \<name>?** window opens.

4. Select the role in the **User role** field. Built-in roles in this list are named differently — see the mapping in the table below.

   The **Cluster master** role gives full access to the cluster, including users and the security policy. Assign it only to cluster administrators.

5. Select the VDC in the **VDC** field. Cluster-wide roles — **Cluster master**, **Security Admin**, **Resource viewer** — do not have this field.

6. Click **Assign**. The button is unavailable until a role is selected, or if this role is already assigned in this VDC. The web interface shows **User \<name> (id: \<number>) is now \<role> in \<VDC>**.

How built-in roles are named in the **User role** field:

| In the **User role** field | Role |
| - | - |
| `Cluster Master` | **Cluster master** |
| `Security Admin` | **Security Admin** |
| `Resource Viewer` | **Resource viewer** |
| `vDC Admin` | **VDC admin** |
| `VM Developer` | **Vm Developer** |
| `vDC User` | **VDC user** |
| `vDC Viewer` | **VDC viewer** |

Custom roles appear in the list under the names they were given at creation.

## Check the result

Open the **Assigned roles** section on the user page. A role in a VDC appears in the **Roles** column in the row of that VDC. A cluster-wide role is in the row where **VDC ID** is `0`.

The server applies the role to the user's next request: the user does not need to sign in again. The user sees the menu items and actions of the new role after refreshing the web interface page: the web interface loads permissions at sign-in and when a page opens.

## More

- You can assign one role to a user in several VDCs: repeat the steps for each VDC.

- You grant roles in a VDC only here, on the user page. On the VDC page, the **VDC roles** block only shows them — [Assign roles within a VDC](/hcp/3.3/en/vdcs/assign-vdc-roles/index.md).

- To remove a role, click ⋯ in the VDC row of the **Assigned roles** section and select **Deassign a Role** — the role name is shown next to the item — then **Deassign** in the confirmation window. The same works through **Actions** → **Deassign a Role** on the user page: select **VDC** and **User role** and click **Deassign**. If you remove your own last **Cluster master** role, the web interface warns **Your session will be interrupted** and ends your session.

## Next

- [Restrict sign-in by address (CIDR) and virtual host](/hcp/3.3/en/users/restrict-user-access/index.md)
- [Roles and access](/hcp/3.3/en/users/index.md) — scopes and built-in roles.
- [Roles and privileges](/hcp/3.3/en/reference/roles-privileges/index.md) — the full set of privileges in each role.

API methods: `user-role-assign`, `user-role-deassign` — in the [API reference](/hcp/3.3/en/api/methods/index.md).
