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.
Summary
If you log in as a Bitbucket Administrator then select 'Administration' > 'Licensing', you will see the number of licensed users.
This number is exhausted but it isn't evident what users are occupying license seats. Which users are counted?
Environment
Applies to Bitbucket Server and Bitbucket Data Center installations.
Solution
Method #1 (Bitbucket version 5.2.0+ only)
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"
- Click Install
Once the plugin is installed, you may have to wait for a while. For 100k users, it 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:
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 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 users details
To get details, which include the user name, display name, email address and last login timestamp, run:
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 refresh the table, Use the following REST endpoint:
curl -u <admin-user> -X POST <bitbucket_url>/rest/panopticon/1.0/scheduler/collect-data
Alternative: The plugin can be disabled, then re-enabled. After one minute, the plugin will run to refresh the table.
Method #2
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-on
and click on "Upload add-on". - Paste the following URL into the "
From this URL"
field and click "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, then:
- Browse to
<bitbucket_url
>/plugins/servlet/users-with/LICENSED_USER
which will display the active licensed users.
- Browse to
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 3 months for example.
To achieve that you can use the REST API endpoint /rest/api/1.0/admin/license to get the maximumNumberOfUsers, which is your upper bound for your current ongoing license as well as the currentNumberOfUsers which is 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>"
}
Existing feature request
- BSERV-7571Getting issue details... STATUS