Skip to content

Instantly share code, notes, and snippets.

@Dalmirog-zz
Last active August 29, 2015 14:28
Show Gist options
  • Save Dalmirog-zz/5e4a437367141249d4e2 to your computer and use it in GitHub Desktop.
Save Dalmirog-zz/5e4a437367141249d4e2 to your computer and use it in GitHub Desktop.
Add an environment to an existing phase
#### Adding an environment to an existing phase####
$lifecyclename = ""
$phasename = ""
$environmentID = "" #must be a single value
$lifecycle = Get-OctopusLifeCycle -LifeCycleName $lifecyclename -resourceonly
$lifecycle.Phases | ?{$_.name -eq $phasename } | %{$_.OptionalDeploymentTargets.Add($environmentID)} #Optional deploy Env
#$lifecycle.Phases | ?{$_.name -eq $phasename } | %{$_.AutomaticDeploymentTargets.Add($environmentID)} #Automatic deploy Env
Update-OctopusResource -Resource $lifecycle -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment