Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$organization = "your_organization_name"
$PAT = "your_PAT"
$project = "your_project_name"
$planId = "testplan_id_from"
$suiteId = "testsuite_id_from"
$cloneTo = "name_of_new_testplan"
$authorization = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$PAT"))
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Accept-Charset", 'UTF-8')
$headers.Add('Authorization',"Basic $authorization")
"destinationTestPlan": {
"name": "$cloneTo",
"Project": {
"Name": "$project"
"options": {
"copyAncestorHierarchy": true,
"copyAllSuites": true
"suiteIds": [
$apiUrl = "$organization/$project/_apis/test/Plans/$planId/cloneoperation?api-version=5.0-preview.2"
Invoke-WebRequest -Uri $apiUrl -Method POST -Headers $headers -Body $postParams | Select-Object -Expand StatusDescription

This comment has been minimized.

Copy link
Owner Author

@Branyac Branyac commented Apr 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment