How to allocate the 'Jira Service Management - Customer' role in bulk?

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

We have seen issues where the 'Jira Service Management - Customer' role is not allocated to the Internal customer(with Atlassian account) post-migration from Datacenter/On-premises to cloud.

This article provides a workaround to bulk update users to the 'Jira Service Management - Customer' role.

Environment

  • Jira Service Management cloud. 

Cause

Recently 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

  • Post-migration from Datacenter/On-premises to cloud, 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.  

Solution

Obtain a list of the users that need to be bulk updated with the 'Jira Service Management - Customer' role

CSV File

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:

  1. Go to Atlassian Admin page and select the site where users must be allocated with the Customer role.
  2. Select the option to export the users. One could also click on the ellipsis button to see it.
  3. Next, select the users to be exported, picking only the ones that must be added to the group. 
    1. If it is too much work to find out the users to who we want to give customer roles, you can export all customer roles and add them to your list. There is no harm if we provide them for all.
  4. Export the file.

Formatting the List of Users

Once the file is downloaded, open it and edit it as described below:

  1. Select the File and open it in a text editor of choice.

  2. Delete all the headings from the file beside the User ID and User name.

  3. Delete all the content from the lines beside the User ID and User name.

  4. After that, change the name of the heading for:

    1. User ID → accountId

    2. Username → displayName

  5. In the end, the file should look similar to this:

  6. Save the file in CSV format.


Now you have to options to choose to perform the bulk update

  1. Use a free app called Bulkops to add users to groups on your cloud site.

    Using the Bulkops App

    Installing the App

    First, the app needs to be installed. The process is similar to installing any Jira app:

    1. Go to Jira cloud.

    2. Go to the" Apps > Explore more Apps."

    3. In the search bar, type "Bulkops. "

    4. Select the Bulkops App by Elf Apps.

    5. Click to install the app.

    6. Open the menu Apps > Bulkops App

    (warning) 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:

    1. First, one must create an API token: Manage API Tokens for your Atlassian Account.
    2. Once done, go to Apps > Bulkops App > Settings > Configurations inside Jira.
    3. In the next screen, select the option to Edit Token.
    4. Paste the API token obtained in Step 1.
    5. 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.

    1. Go to the Bulkops app in Apps > Bulkops App > Users > Bulk add users to groups.
    2. Here one should see a page to import the file built on the previous step.
    3. After importing the file, a progress bar should appear, indicating the operation's progress.
    4. Once the operation's done, all users will have been deleted.
  2. Use Atlassian REST API Add user to group capabilities to add a user to a group.

    Using REST API

    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:

    1. First, one must 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 delete users in bulk:
    cURL Script

    Addgroup.sh
    #!/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, one must:

    1. First, replace "FILE_NAME" with the file name where all users to be added to the group are stored.
    2. Replace "EMAIL_ADDRESS" with the email address of the administrator running the script.
    3. Replace "API_TOKEN" with the API Token of the administrator running the script.
    4. Replace "<yoursite>.atlassian.net" with the cloud address from which users must be added to the group.
    5. Save the script as "Addgroup.sh" in the location where FILE_NAME.csv is located.
    6. Edit your CSV with no headers and a blank line after your last user.
    7. Execute it via the command line:


    cURL Script

    ./Addgroup.sh

    NOTE: If we 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
     





Last modified on Feb 2, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.