Created
October 12, 2017 22:45
-
-
Save flcdrg/58a4dc0762265c298f637d1d9dda330e to your computer and use it in GitHub Desktop.
TeamCity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$data = @{ | |
"GROUP_KEY" = "Group Description" | |
} | |
$user = "xxxxxx" | |
$password = "xxxxxx" | |
$pair = "$($user):$($password)" | |
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair)) | |
$basicAuthValue = "Basic $encodedCreds" | |
$headers = @{ | |
"Authorization" = $basicAuthValue; | |
"Accept" = "application/xml"; | |
"Content-Type" = "application/xml"; | |
} | |
$data.Keys | % { | |
$body = "<group key='$_' name='$($data[$_])' />" | |
$body | |
Invoke-WebRequest -Uri "http://server:8111/app/rest/userGroups" -Method Post -Body $body -Headers $headers | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment