<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=299788&amp;fmt=gif">
Go Back

Test Jira Admin Tip #4 - A Groovy Way to Find All Licensed and Active Users

Amanda Kirk Amanda Kirk | March 2, 2026 | 3 MIN READ
Jira, Admin, Tip, Groovy

Untitled-257

Here at Isos, we've seen use cases for pretty much everything. One use case that has come up for both my clients and myself as an admin has been identifying all licensed or active users in Jira or Jira Service Management (JSM) in order to audit the instance, free up inactive licenses, or simply get a list of users for communications purposes. Whatever the reason, going through the list of users in the UI is clunky, so in this blog post I will show you how to quickly identify all licensed or active users using a simple Groovy script! To run it, just pull up a Groovy console in Jira (note that a Groovy console comes with some typical apps like JMWE and may not be available out-of-the-box).

Let's jump right into it!

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.application.ApplicationAuthorizationService
import com.atlassian.jira.application.ApplicationKeys
 
 
UserUtil userUtil = ComponentAccessor.getUserUtil()
def applicationAuthorizationService = ComponentAccessor.getComponent(ApplicationAuthorizationService)
def sb = new StringBuffer()
int licenses = 0
 
//iterate over all users
userUtil.getUsers().each{ u ->
    //checks active and licensed for Jira Software app
    if ((u.active) && (applicationAuthorizationService.canUseApplication(u, ApplicationKeys.SOFTWARE)))
    {
        sb.append(u.displayName + " : " + u.emailAddress + "\n")
        licenses++
    }
 
}
 
sb.append("TOTAL LICENSED USERS: " + licenses)
return sb.toString()

 

As you can see from the above, we use the UserUtil and applicationAuthorizationService from the Jira API to iterate over all users in the instance, checking if they are marked as active and have a Jira Software license. A sample of output from the script is shown below:

 

image2021-4-26_9-40-16

 

You can validate these results by first looking at User Management in the Jira UI and filtering by Active and Jira Software access:

 

image2021-4-26_9-41-5

 

As you can see, this returns the same results as the script!

Now, what if you want to check active and licensed users in JSM?

One simple change to the script will do! 

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.application.ApplicationAuthorizationService
import com.atlassian.jira.application.ApplicationKeys
 
 
UserUtil userUtil = ComponentAccessor.getUserUtil()
def applicationAuthorizationService = ComponentAccessor.getComponent(ApplicationAuthorizationService)
def sb = new StringBuffer()
int licenses = 0
 
//iterate over all users
userUtil.getUsers().each{ u ->
    //checks active and licensed for Jira Software app
    if ((u.active) && (applicationAuthorizationService.canUseApplication(u, ApplicationKeys.SERVICE_DESK )))
    {
        sb.append(u.displayName + " : " + u.emailAddress + "\n")
        licenses++
    }
 
}
 
sb.append("TOTAL LICENSED USERS: " + licenses)
return sb.toString()

 

And voilà! It's as simple as that! I hope these script snippets can help speed your admin tasks or client needs. And as always, happy automating!

New call-to-action

Recent Articles

7 Things to Know About Atlassian's Jira Service Management (JSM)
Test 7 Things to Know About Atlassian's Jira Service Management (JSM)
Atlassian created Jira Service Desk in 2013, after noticing that nearly 40% of its customers had adapted Jira's pre-existing issue and project tracking software to handle service requests for their...
Isos Technology Isos Technology 4 MIN READ
Read More
DoD SkillBridge
Test Isos Technology and Isos Federal Become Official DoD SkillBridge Partners
Isos Technology and Isos Federal are proud to announce that we have been officially approved as partners in the U.S. Department of Defense SkillBridge program.
Isos Technology Isos Technology 2 MIN READ
Read More
Test Most teams think they're aligned. The data reveals otherwise.
Guest Blog: The Tempo team Nine out of ten organizations say they encourage adaptability and alignment across all teams. But stated alignment and actual, operational alignment are not the same. And,...
Isos Technology Isos Technology 5 MIN READ
Read More