How do I find which users count against my Bitbucket Server license?
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
The content on this page relates to supported platforms; however, the content is out of scope of our Atlassian Support Offerings. Consequently, Atlassian can't guarantee support. Please be aware that this material is provided for your information only, and you may use it at your own risk.
Summary
If you log in as a Bitbucket administrator and go to Administration > Licensing, you will see the number of licensed users.
This number is exhausted, but it isn't evident what users occupy license seats. Which users are counted?
Environment
Applies to Bitbucket Server and Bitbucket Data Center installations.
Solution
Since Bitbucket 8.12.x, you can search for and filter out licensed users on the Users page.
To find out if a user is licensed, check the Licensed column. You can also use filters to find users by their license statuses, last authentication time, and directory. In the Export menu, apart from the users and user permissions options, you can now select Users (Filtered results) to export the data on the users you've filtered out.
Check the updates to the Users page on the following screenshot:
1 – the Licensed column
2 – the filters for the license status, last authentication time, and directory
3 – the Export menu with the new option Users (Filtered results)
You can also check how many free seats your license is providing. To do this, use the JMX metrics for licensed users statistics.
Other methods
If you haven't upgraded to Bitbucket 8.12.x or later, you can use a few other methods to find licensed users in your instance
Method #1 (Bitbucket 5.2.0+ only): Install the Centralized License Visibility plugin
Install the Centralized License Visibility plugin:
- Log in to Bitbucket Server as an administrator and go to Administration > Find new apps.
- Search for "centralized license visibility".
- Select Install.
Once the plugin is installed, you may have to wait a while. For 100k users, this may take up to 10 minutes, so 15-20 minutes should be adequate.
Then, run the following queries against the database.
Licensed users count
To get the number of licensed users, run the following queries:
SELECT "VERSION", COUNT(*) FROM "AO_A020FF_LICENSED_USER" GROUP BY "VERSION" ORDER BY 1 DESC;
SELECT version, COUNT(*) FROM AO_A020FF_LICENSED_USER GROUP BY version ORDER BY 1 DESC;
The plugin always maintains the last two sets of licensed users collected. Hence, a descending sort by version will show the latest licensed user count on the first row of the output.
The table will be refreshed 24 hours after the last run of the plugin.
Licensed user details
To get licensed user details (the user name, display name, email address, and last login timestamp), run the following queries:
SELECT * FROM "AO_A020FF_LICENSED_USER" WHERE "VERSION" = (SELECT MAX("VERSION") FROM "AO_A020FF_LICENSED_USER");
SELECT * FROM AO_A020FF_LICENSED_USER WHERE VERSION = (SELECT MAX(VERSION) FROM AO_A020FF_LICENSED_USER);
Licensed users data refresh
To force the table refresh, use the following REST endpoint:
curl -u <admin-user> -X POST <bitbucket_url>/rest/panopticon/1.0/scheduler/collect-data
Alternatively, you can disable and then re-enable the plugin. After one minute, the plugin will run to refresh the table.
Method #2 (Bitbucket 5.2.0+ only): Install the User Permission Debugger plugin
Bitbucket development team wrote a small plugin that will help determine what users Bitbucket Server sees:
- Log in to Bitbucket Server as an administrator and go to Administration > Manage Add-ons.
- Select Upload add-on.
- Paste the following URL to the From this URL field and select Upload: https://packages.atlassian.com/maven/com/atlassian/bitbucket/plugins/user-permission-debugger/0.9.0/user-permission-debugger-0.9.0.jar
You can also go to the link to download the jar and use the upload option. Wait for the plugin to install.
Browse to
<bitbucket_url
>/plugins/servlet/users-with/LICENSED_USER
which will display the active licensed users.
The plugin is locked down to administrators but it can be uninstalled from the Manage plugins screen if preferred.
Side note
You may want to get the number of licenses being consumed and when the license will expire via a script. You may want this script to start sending emails when 90% of your user tier is utilized or when the license will expire within three months, for example.
To achieve that, you can use the REST API endpoint /rest/api/1.0/admin/license
to get the following:
maximumNumberOfUsers
– your upper bound for your current ongoing license.-
currentNumberOfUsers
– the number of licensed users in the system:
curl -u username:password -X GET <bitbucket_url>/rest/api/1.0/admin/license
{
"creationDate": 1532872800000,
"purchaseDate": 1532872800000,
"expiryDate": null,
"numberOfDaysBeforeExpiry": 2147483647,
"maintenanceExpiryDate": 1564408800000,
"numberOfDaysBeforeMaintenanceExpiry": 203,
"gracePeriodEndDate": null,
"numberOfDaysBeforeGracePeriodExpiry": 2147483647,
"maximumNumberOfUsers": 100,
"unlimitedNumberOfUsers": false,
"serverId": "<My server ID>",
"supportEntitlementNumber": "SEN-500",
"license": "<My license number>",
"status": {
"currentNumberOfUsers": 13,
"serverId": "<My server ID>"
}