Jira Cloud - Scriptrunner to add users to a group

Alex Ziegltrum December 15, 2022

Hey there 👋,

I want to use ScriptRunner, to add around 500 users to a certain group.

I found a couple of tips from other users, but they all relate to Jira server

How do I do this in Cloud?

Thanks :)

1 answer

1 vote
Brant Schroeder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 15, 2022

@Alex Ziegltrum Welcome to the Atlassian community

Adaptavist answered this in a different community post and the answer still stands true today.  https://community.atlassian.com/t5/Jira-Software-questions/How-to-add-users-to-a-JIRA-group-with-Scriptrunner-Cloud/qaq-p/1302299 

"I can confirm that it is not possible with ScriptRunner for Jira Cloud to set users as members of groups.

The reason for this is that the Add User to Group which Atlassian provide as documented here is marked as Apps cannot access this REST resource.

This means that ScriptRunner for Jira Cloud will be unable to make a call to this Rest API as it is only permitted to use the API's which Atlassian allow Apps to access."

Alex Ziegltrum December 16, 2022

@Brant Schroeder thanks for picking up my topic and for your quick answer :)

I have checked out the linked post, which is almost 2 years old. Meanwhile I got this answer from one of the Adaptavist techs. As I understand, it should be possible by now:

I can confirm that you will be able to add users to one group calling the following REST API call[ here|https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-group-user-post] . Please, keep attention to the permissions required to run the previous API call ,  the user who call the script have to be a member of "site-admin" and you will need to generate an API Token  to use an authentication mode when you call the function.  I mean:

// where the email of one member of site-admin ,  and the password is the API Tokendef result = post("/rest/api/3/group/user")    .header('Content-Type', 'application/json')    .basicAuth('user','passw')

Unfortunately, I do not have the necessary programming skills to work it out by myself, I have to find a different (GDPR supporting) solution.

Aaron Geister
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 29, 2022

So I have asked Atlassian & Adaptavist to try and get something moving to make this work without all the overhead. 

For security purposes is probably why they haven't released a fix for this but it is weird that you can do it from the outside via API but not from app add-on or from a native answer like Automation for Jira. 

I did find away to do this but you will have to use some engineering and you have to use an IPAAS system. I used BetterCloud to do this from our JSM requests. It is a lot to set up but it does work. 
I would much rather this be an ability that Scriptrunner and or Automation for Jira can handle. 

The other thing is to get an IDP that is able to use SCIM which is the best way and we are migrating our groups from Atlassian directory to SCIM to help mitigate this issue. 

Best of luck.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 29, 2022

There is also the problem that Jira Cloud does not actually handle users and groups.  It's done by either site admin, or Atlassian Access, which are both separate systems to Jira.

Like • Aaron Geister likes this
Aaron Geister
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 30, 2022

Thanks @Nic Brough -Adaptavist- for the insight. I now have a better idea of the issue at hand. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events