How do I find which users count against my Bitbucket Server license?

Still need help?

The Atlassian Community is here for you.

Ask the community

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:

  1. Log in to Bitbucket Server as an administrator and go to Administration >> Find New Apps
  2. Search for "centralized license visibility"
  3. 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 query against the database:

PostgreSQL
SELECT "VERSION", COUNT(*) FROM "AO_A020FF_LICENSED_USER"  GROUP BY "VERSION" ORDER BY 1 DESC;
Oracle
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.

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:

  1. Log in to Bitbucket Server as an administrator and go to Administration > Manage Add-on and click on "Upload add-on".
  2. 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.
  3. Wait for the plugin to install, then:

    • 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:

(info) 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 
Output Example
{
 "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-7571 - Getting issue details... STATUS


DescriptionThe number of licensed users is exhausted but it isn't evident what users are occupying license seats.
Last modified on Jul 13, 2021

Was this helpful?

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