AzureFeaturedScripts

Get List of Users from Azure DevOps Organization

Azure DevOps organization users/username

Retrieve total number and username of users from Azure DevOps Organization.

<#
.SYNOPSIS
    This script to get list of users/usersname from azure devops organization
.DESCRIPTION
    This script to get list of users/usersname from azure devops organization
.PARAMETER -Organization
    use -organization parameter to include your devops organization URL

.EXAMPLE
    get-organizationUsersCount -organization "devops org URL"

#>

Function get-organizationUsersCount {

param(
    [CmdletBinding()]
    [parameter(mandatory = $true)][String]$organization
)

   #######################################################################3
   ### Get count of all users
   $users = az devops user list --org $organization | ConvertFrom-Json
   $UserCount = $users.members.user.count
   write-host "Total  $($UserCount) Users in $($organization)" -ForegroundColor Green

   $allUsers = az devops user list --org $organization | ConvertFrom-Json
   $users= foreach($au in $allUsers.members)
    {
       Write-Host $au.user.principalName
    }

    $users
    
    
}

 

 

Show More

Related Articles

Back to top button