Skip to content

Instantly share code, notes, and snippets.

@Dalmirog-zz
Last active August 29, 2015 14:12
Show Gist options
  • Save Dalmirog-zz/21ad5eeadca29c3e8ec1 to your computer and use it in GitHub Desktop.
Save Dalmirog-zz/21ad5eeadca29c3e8ec1 to your computer and use it in GitHub Desktop.
Octopus - Delete LifeCycle using REST API
#Change dll path accordingly
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Newtonsoft.Json.dll"
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Octopus.Client.dll"
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Octopus.Platform.dll"
#Connection data
$apikey = "YOUR-API"
$OctopusURI = "http://YourOctopusURL"
$headers = @{"X-Octopus-ApiKey"="$($apikey)";}
$endpoint = new-object Octopus.Client.OctopusServerEndpoint "$($OctopusURI)","$($apikey)"
$repository = new-object Octopus.Client.OctopusRepository $endpoint
#I.e "Lifecycles-2" (Open the lifecycle you want to delete from the Web UI and check the URL if unsure of this value)
$LifecycleID = ""
Invoke-WebRequest -Uri $octopusURI/api/lifecycles/$LifecycleID -Method Delete -Headers $headers -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment