Skip to content

Instantly share code, notes, and snippets.

@flcdrg
Created October 12, 2017 22:45
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 flcdrg/58a4dc0762265c298f637d1d9dda330e to your computer and use it in GitHub Desktop.
Save flcdrg/58a4dc0762265c298f637d1d9dda330e to your computer and use it in GitHub Desktop.
TeamCity
$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