Bulk Assign the 'Customer' Role in Jira Service Management Cloud
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
The 'Customer' role isn't always assigned to internal Atlassian accounts after migrating to Cloud, so learn how to bulk update users to the 'Jira Service Management - Customer' role.
What causes this issue?
JSM Introduced a dedicated product access role for internal customers in Jira Service Management. With this change, you will be able to select the appropriate product access role for new and existing users, allowing them to be either a "User (Agent)," "Customer," or "None."
Jira Administrators will be able to set granular permissions to control access explicitly.
However, there are some limitations as follows:
- Internal portal customers who migrated from DC to the Cloud will not get allocated with 'Jira Service Management - Customer.'
- Users syncing from the Active directory should have a customer role by default.
Bulk assigning the customer role
Obtain a list of the users that need to be bulk updated with the 'Jira Service Management - Customer' role:
List of Users
This CSV file format will be the same for both approaches, Bulkops APP and REST API call.
To obtain a list of users:
- Go to Atlassian Admin page and select the site where users must be allocated with the Customer role.
- Select the option to export the users. One could also click on the ellipsis button to see it.
- Next, select the users to be exported, picking only the ones that must be added to the group.
- If it is too much work to find out which users we want to assign customer roles to, you can export all customer roles and add them to your list. It is no harm if we provide them for all.
- Export the file.
Formatting the List of Users
Once the file is downloaded, open it and edit it as described below:
Select the File and open it in a text editor of choice.
Delete all the headings from the file beside the User ID and User name.
Delete all the content from the lines beside the User ID and User name.
After that, change the name of the heading for:
User ID → accountId
Username → displayName
- Save the file in CSV format.
Now you have to options to choose to perform the bulk update.
Use a free app called Bulkops to add users to groups on your cloud site
Installing the App
First, the app needs to be installed. The process is similar to installing any Jira app:
Go to Jira cloud.
Go to the" Apps > Explore more Apps."
In the search bar, type "Bulkops. "
Select the Bulkops App by Elf Apps.
Click to install the app.
Open the menu Apps > Bulkops App
This is a free app; the only requirement is creating an Elf Apps account.
Setup your account
After creating the account with Elf Apps, the same must be activated. To do so, one must click the activation email to be sent to the chosen address while creating the account.
Setup the API Token
The next step to use the app is to give it an API token as it will use Atlassian's REST API to bulk add the users to the group:
- First, one must create an API token: Manage API Tokens for your Atlassian Account.
- Once done, go to Apps > Bulkops App > Settings > Configurations inside Jira.
- In the next screen, select the option to Edit Token.
- Paste the API token obtained in Step 1.
- The "TOKEN STATUS" should be "Active. "
Using the app
To use the app, an admin must have a list of the users that must be added to the group and in a format that respects the needed structure for BulkOps to work.
See the section CSV file above.
- Go to the Bulkops app in Apps > Bulkops App > Users > Bulk add users to groups.
- Here one should see a page to import the file built on the previous step.
- After importing the file, a progress bar should appear, indicating the operation's progress.
- Once the operation's done, all users will have been deleted.
Use Atlassian REST API Add user to group capabilities to add a user to a group
Setup the API Token
The next step to use the app is to give it an API token as it will use Atlassian's REST API to bulk add the users to the group:
- First, it's necessary to create an API token: Manage API Tokens for your Atlassian Account.
Get a List of Users
See the section CSV file above.
Using the API via Curl (example)
Here's the script to add users to the group in bulk:
#!/bin/bash
cat FILE_NAME.csv | while read line;
do
echo $line
displayName=`echo $line | cut -d ',' -f2`
aaid= `echo $line | cut -d ',' -f1`
echo "adding user $displayName - $aaid to the group"
curl --request POST --url 'https://your-domain.atlassian.net/rest/api/2/group/user?groupId={groupId}' --user 'email@example.com:<api_token>' --header 'Accept: application/json' --header 'Content-Type: application/json' --data '{"accountId": "'$aaid'"}'
done
To execute it:
- First, replace "FILE_NAME" with the file name where all users to be added to the group are stored.
- Replace "EMAIL_ADDRESS" with the email address of the administrator running the script.
- Replace "API_TOKEN" with the API Token of the administrator running the script.
- Replace "<yoursite>.atlassian.net" with the cloud address from which users must be added to the group.
- Save the script as "Addgroup.sh" in the location where FILE_NAME.csv is located.
- Edit your CSV with no headers and a blank line after your last user.
- Execute it via the command line:
cURL Script
|
NOTE: If you add customers in this "jira-service management-customers-yourSiteName," default group, they will automatically get the Jira Service Management - Customer role.
To obtain the groupId navigate to admin.atlassian.com > Directory > Groups, select the group you wish to add the users to and copy the group ID from the URL, which is after "/groups/". Example:
- https://admin.atlassian.com/o/xxxxx-xxxxx-xxxxxx/groups/fecdb399-ef1d-1234-a44d-e30860fb09c4