How to add a user as Project Admin for multiple projects using Run CLI Action for Jira app
This article explains how to add a user as Project Admin for multiple projects using the app, Run CLI action for Jira.
Instructions
For this scenario, use the runFromCsv and addProjectRoleActors actions where:
addProjectRoleActors: Adds users or groups from a project role.
runFromCsv: Run actions generated from a CSV file.
Consider the following example that shows a project key TC, with the project name, TEST CLI, and has a role defined as jira-administrators:
Create a csv file, projects.csv, with parameters:
Place the projects.csv under the folder, /var/atlassian/application-data/home/cli-plugin.
Navigate to Admin > Manage Apps > Run Actions and execute the following CLI action:
--action run --server http://example.test.com --password xxxxxxx --user xxxxxxx --action runFromCsv --file "remove.csv" --common "--action addProjectRoleActors"Click on Run and below is the required output:
Success Run: --action runFromCsv --file "remove.csv" --common "--action addProjectRoleActors" Run: --project "JIRA" --role "jira-administrators" --userId "Amulya" --category "standard" --action addProjectRoleActors 'jira-administrators' role updated for project JIRA Run: --project "QA" --role "jira-administrators" --userId "Amulya" --category "standard" --action addProjectRoleActors 'jira-administrators' role updated for project QA Run: --project "BUMP" --role "jira-administrators" --userId "Amulya" --action addProjectRoleActors 'jira-administrators' role updated for project BUMP Run: --project "TC" --role "jira-administrators" --userId "Amulya" --action addProjectRoleActors 'jira-administrators' role updated for project TC Run: --project "ZJCLI" --role "jira-administrators" --userId "Amulya" --action addProjectRoleActors 'jira-administrators' role updated for project ZJCLI Run completed successfully. 5 actions were successful from file: /var/atlassian/application-data/home/cli-plugin/remove.csv Run completed successfully. 1 actions were successfulThe result of the above action is shown in the following screenshot:
Make sure you have installed the Run CLI action in Jira v9.2 app as the action addProjectRoleActors is compatible with the app from v9.2 onwards.
It is recommended to test this scenario in a test environment before implementing it in production.