How can I find which users have a role assigned to them?

(Mark Harrison) #1

My compliance team got in touch and they wanted to know who has system administration rights, and who can view Projects within Octopus.

I need to find a list of users who have the System administrator role and the ProjectViewer role assigned to them in Octopus.

Is there a way to find this out?

(Mark Harrison) #2

This can be achieved using the Octopus REST API.

We have created a script which will find users in a specific role in our OctopusDeploy-API github repo here.

Just set the working variables at the top of that script, so for the Project Viewer role set it as below:

$OctopusServerUrl = "https://url-to-your-octopus-server"
$ApiKey = "API-XXXXXXXXXXXXXXXX"
$RoleName = "Project Viewer"

Example output:

PS C:\Users> D:\OctopusDeploy-Api\REST\PowerShell\Users\FindUsersWithUserRole.ps1
Team: Space Managers
mark.harrison
External security groups:
Team: Test team
Tester1
External security groups: