This article explains how to add a user to a project role using the Jira Command Line Interface (CLI) app in Jira Cloud.
For this scenario, use the addProjectRoleActors action with the userId parameter.
- addProjectRoleActors: Add users or groups to a project role
- userId: Specify user ID for user management and other actions. For some actions, you can use a comma-separated list of IDs. For Cloud, use the account ID or a public name.
For this example, assume that there are existing roles for a project as follows:
Execute the following CLI command to add the project role, jira-software-users, to the user, Rufas:
--action addProjectRoleActors --project "JIRACLI" --role "jira-software-users" --userId "Rufas"
If there are no errors, the following output appears after the execution of the above command:
'jira-software-users' role updated for project JIRACLI
You can check that the respective role is added for the user in the Jira's Users and roles section as shown:
- Make sure you have installed version 9.2 of the Jira Command Line Interface(CLI) app as the addProjectRoleActors action is compatible with Jira CLI from v9.2.
- Ensure that the project roles are added at the global level.
- It is recommended to test this scenario in a test environment before implementing it in production.