Create custom roles
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.1
Access organization settings and select Users and roles
From the services page, select the name of your organization. Select the
Users and roles menu item from the popup menu.2
Select the Roles tab
Select the
Roles tab from the top middle of the screen.3
Select Create new role from the upper right
Select the
Create new role button in the upper right of the screen.4
Name the role
Enter a descriptive role name. This will be the name you will see when assigning roles to users and API keys.
5
Click Allow and select permission scope
Click the
Allow button and select from Organization, Service, and/or Database permissions. For a description of all permissions, see Console roles and permissions.Data Sources tab accessTo access the Data Sources tab, the role currently requires the
Manage selected services permission.6
Review your new role
Review permissions assigned to your new role before finalizing. Click
Create role when done.Manage database roles (beta)
In addition to console permissions, custom roles can include aData policy that controls access to the databases of selected services. This lets you manage console and database access in one place instead of maintaining separate roles in each database.
This feature is in beta and is available for services running ClickHouse version 26.4 and above.
Data policy to a custom role, ClickHouse Cloud creates a matching role in each selected service, prefixed with cloud:. For example, a custom role named readonly appears in the database as cloud:readonly. Members of the custom role receive these database permissions when they connect to the service through SQL console passwordless authentication.
Prerequisites
Custom database roles on a service depend on JWT authentication and are not applied while it is disabled. Before adding aData policy to a role, navigate to the service, open Settings, and find the JWT authentication card in the Security section. Make sure the SQL Console toggle is enabled.
1
Open the role dialog
Create a custom role or edit an existing one.
2
Add an organization policy
In the role dialog, click
Allow, select Organization, and enable the Access organization permission.3
Add a service policy
Click
Allow permissions, select Service, choose the services the data policy will apply to, and enable the View selected services permission.Members of the role need both permissions to sign in to the console and open the service in the SQL console, where the data policy applies.4
Add a data policy
Click
Allow permissions and select Data.5
Select the service
Select the service the policy applies to. Add more services to apply the same
Read-only or Admin permissions across multiple services.6
Choose the access level
Select
Read-only, Admin, or Custom access. With Custom access, define specific data access permissions using ClickHouse GRANT statements. Custom access can only be selected when the policy targets a single service; to define custom permissions for multiple services, add a separate Data policy for each service.7
Create the role
Click
Create role. The database roles are created in the selected services. The roles can take up to 10 minutes to propagate to a service, but users assigned the role receive its permissions immediately when they query the service.Verify database roles
Roles managed through the console are created in the database with thecloud: prefix and the cloud storage type, and can take up to 10 minutes to appear after creation. To list them, query the system.roles table in the service:
Update custom roles
Custom roles may be updated after they’re created. Users will lose any permissions removed from the role and will gain any permissions added.- Access organization settings and select
Users and roles - Select the
Rolestab - Select the three dots next to the role you would like to update
- Select
Edit - Modify the permissions
- Select
Edit role
Delete custom roles
Custom roles may be deleted at any time.- Access organization settings and select
Users and roles - Select the
Rolestab - Select the three dots next to the role you would like to delete
- Review the users and API keys that will lose access when the role is removed. Adjust assignments as needed.
- Select
Delete roleto complete the process