Skip to content

Instantly share code, notes, and snippets.

@JasperGilhuis
Last active April 1, 2020 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JasperGilhuis/3177e113af5b868853a1694f27a1b823 to your computer and use it in GitHub Desktop.
Save JasperGilhuis/3177e113af5b868853a1694f27a1b823 to your computer and use it in GitHub Desktop.
AZ DevOps CLI - Add Team Administrator
# Adding a Team Administrator
# credits: David https://stackoverflow.com/questions/59829312/how-to-add-team-administrator-using-azure-cli/60062489
$myOrg = "https://dev.azure.com/<<your org>>/"
$newTeam = "Test Team"
$newAdmin = "<<user email>>"
$myProject = "Boards Demo"
echo $env:PAT | az devops login --organization $myOrg
# improve with team list
$team = az devops team create --name $newTeam --org $myOrg --project $myProject | ConvertFrom-Json
$user = az devops user show --user $newAdmin --organization $myOrg | ConvertFrom-Json
az devops security group membership add --group-id $team.identity.subjectDescriptor --member-id $user.user.descriptor --org $myOrg
az devops security permission update --id "5a27515b-ccd7-42c9-84f1-54c998f03866" --subject $user.user.principalName --token "$($team.projectId)\$($team.id)" --allow-bit 31 --org $myOrg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment