> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage custom roles

> This page describes how administrators can add, modify, and remove custom roles

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

This guide is intended for users with the Admin role in ClickHouse Cloud.

ClickHouse Cloud customers may select from pre-defined system roles or create custom roles to assign to users. For more information on system roles and their associated permissions, review [Console roles and permissions](/docs/products/cloud/reference/security/console-roles). This guide provides details for managing custom roles.

<h2 id="create-custom-role">
  Create custom roles
</h2>

Custom roles can contain a combination of organization, service, and database permissions. Permissions may be applied to all or a subset of services and databases.

<Steps>
  <Step title="Access organization settings and select Users and roles" id="users-and-roles-1">
    From the services page, select the name of your organization. Select the `Users and roles` menu item from the popup menu.

    <Image img="https://mintcdn.com/private-7c7dfe99/A68-kVUDkVcT2W3b/images/cloud/guides/control_plane/1_users_and_roles.webp?fit=max&auto=format&n=A68-kVUDkVcT2W3b&q=85&s=812cd3b2f7b7b1d1303efcd9f177d1e9" size="lg" width="3418" height="1702" data-path="images/cloud/guides/control_plane/1_users_and_roles.webp" />
  </Step>

  <Step title={<>Select the <code>Roles</code> tab</>} id="roles-tab">
    Select the `Roles` tab from the top middle of the screen.

    <Image img="https://mintcdn.com/private-7c7dfe99/A68-kVUDkVcT2W3b/images/cloud/guides/control_plane/manage_custom_roles/2_custom_role.webp?fit=max&auto=format&n=A68-kVUDkVcT2W3b&q=85&s=d740c41f79324655f94484b19c18c171" size="lg" width="3414" height="984" data-path="images/cloud/guides/control_plane/manage_custom_roles/2_custom_role.webp" />
  </Step>

  <Step title={<>Select <code>Create new role</code> from the upper right</>} id="create-new-role">
    Select the `Create new role` button in the upper right of the screen.

    <Image img="https://mintcdn.com/private-7c7dfe99/A68-kVUDkVcT2W3b/images/cloud/guides/control_plane/manage_custom_roles/3_custom_role.webp?fit=max&auto=format&n=A68-kVUDkVcT2W3b&q=85&s=6dc41ac61f3b78f6a73f1bce8a5218e4" size="lg" width="3418" height="1706" data-path="images/cloud/guides/control_plane/manage_custom_roles/3_custom_role.webp" />
  </Step>

  <Step title="Name the role" id="name-the-role">
    Enter a descriptive role name. This will be the name you will see when assigning roles to users and API keys.

    <Image img="https://mintcdn.com/private-7c7dfe99/A68-kVUDkVcT2W3b/images/cloud/guides/control_plane/manage_custom_roles/4_custom_role.webp?fit=max&auto=format&n=A68-kVUDkVcT2W3b&q=85&s=ae0347acfc848aca70f60f6e2d1c272b" size="md" width="1200" height="1704" data-path="images/cloud/guides/control_plane/manage_custom_roles/4_custom_role.webp" />
  </Step>

  <Step title={<>Click <code>Allow</code> and select permission scope</>} id="scope-permissions">
    Click the `Allow` button and select from Organization, Service, and/or Database permissions. For a description of all permissions, see [Console roles and permissions](/docs/products/cloud/reference/security/console-roles).

    <Tip>
      Ensure users who will log into the console have a minimum of Organization > Access organization permissions.
    </Tip>

    <Info>
      **Data Sources tab access**

      To access the **Data Sources** tab, the role currently requires the `Manage and Delete Selected Services` permission.
    </Info>

    <Image img="https://mintcdn.com/private-7c7dfe99/A68-kVUDkVcT2W3b/images/cloud/guides/control_plane/manage_custom_roles/5_custom_role.webp?fit=max&auto=format&n=A68-kVUDkVcT2W3b&q=85&s=d0dafb53caa90f6de0ed5581c35ad2c2" size="md" width="1192" height="1700" data-path="images/cloud/guides/control_plane/manage_custom_roles/5_custom_role.webp" />
  </Step>

  <Step title="Review your new role" id="review-role">
    Review permissions assigned to your new role before finalizing. Click `Create role` when done.

    <Image img="https://mintcdn.com/private-7c7dfe99/A68-kVUDkVcT2W3b/images/cloud/guides/control_plane/manage_custom_roles/6_custom_role.webp?fit=max&auto=format&n=A68-kVUDkVcT2W3b&q=85&s=d2c70cb8c98d8e9505ea9ebaca0f6969" size="md" width="1190" height="1696" data-path="images/cloud/guides/control_plane/manage_custom_roles/6_custom_role.webp" />
  </Step>
</Steps>

<h2 id="update-custom-role">
  Update custom roles
</h2>

Custom roles may be updated after they're created. Users will lose any permissions removed from the role and will gain any permissions added.

<Tip>
  User permissions are additive. If a user has permission to perform an operation as part of multiple roles, they may not immediately lose access if permission is removed from only one role.
</Tip>

1. Access organization settings and select `Users and roles`
2. Select the `Roles` tab
3. Select the three dots next to the role you would like to update
4. Select `Edit`
5. Modify the permissions
6. Select `Edit role`

<h2 id="delete-custom-role">
  Delete custom roles
</h2>

Custom roles may be deleted at any time.

<Warning>
  You must have at least one user in the organization with administrative permissions. If deleting the role removes administrative permissions from the last user, you can't delete it. To resolve this, assign at least one user the Admin system role before deleting the custom role.
</Warning>

1. Access organization settings and select `Users and roles`
2. Select the `Roles` tab
3. Select the three dots next to the role you would like to delete
4. Review the users and API keys that will lose access when the role is removed. Adjust assignments as needed.
5. Select `Delete role` to complete the process
