How to create users in Delegated Authentication directory using JIRA REST API
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
The JIRA REST API can be used to create users as per described here: https://docs.atlassian.com/jira/REST/latest/#d2e3697 However, the directory to create users in cannot be specified directly in the POST. We can workaround this by switching directory positions or disabling directories to ensure that JIRA creates the user in the correct directory that we want, as described below.
Solution
JIRA will try to create the user in the top-most and enabled directory.
Note that the REST API can only create users in the Default JIRA Internal Directory, or Internal Directory with Delegated Authentication
To check the position of your directories, go to
Administration >> User Management >> User Directories
Move the directory that you want users to be created in to the top-most position, OR
Disable the top directories and leave only the directory where you want users to be created in enabled.
Examples
Assume that you have 3 directories, in the following order:
Delegated Auth A - Enabled
Default Internal Directory - Enabled
Delegated Auth B - Disabled
To add users to Delegated Auth B you can either disable 1 and 2 and then re-enable 3, or move 3 to the top-most position and re-enable it. After this, run the REST API and it should create the users in 3.
To add users inDelegated Auth A, simply run the REST API, no changes are needed.
To add users inDefault Internal Directory, move it to the top-most position OR disable1.
Changing directory order is further described inhttps://confluence.atlassian.com/jira/managing-multiple-directories-229838552.html
Was this helpful?