Teamcity 8.x REST предоставляет возможность создания конфигурации сборки. Вы можете использовать что-то вроде ниже, чтобы использовать для REST API.
function Create-Build{
param
(
[Parameter(Mandatory=$true)]
[string]
$buildName,
[Parameter(Mandatory=$true)]
[string]
$parentProjectId
)
# Create Teamcity URL
$url = "http://teamcity:8111/httpAuth/app/rest/projects/$parentProjectId/buildTypes"
$webRequest = [System.Net.WebRequest]::Create($url)
$webRequest.ContentType = "text/plain"
$PostStr = [System.Text.Encoding]::UTF8.GetBytes($buildName)
$webrequest.ContentLength = $PostStr.Length
$webRequest.Method = "POST"
$webRequest.Accept = "*/*"
$webRequest.Credentials = new-object system.net.networkcredential("teamcityuser", "password")
$requestStream = $webRequest.GetRequestStream()
$requestStream.Write($PostStr, 0,$PostStr.length)
$requestStream.Close()
[System.Net.WebResponse] $resp = $webRequest.GetResponse();
$rs = $resp.GetResponseStream();
[System.IO.StreamReader] $sr = New-Object System.IO.StreamReader -argumentList $rs;
[string] $results = $sr.ReadToEnd();
$results
}
# Call ps function to create build configuration
Create-Build -buildName "CopiedBuild" -parentProjectId "TestProject"