Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Dalmirog-zz/e642cab7c157d9497b20202aa4baeb33 to your computer and use it in GitHub Desktop.
Save Dalmirog-zz/e642cab7c157d9497b20202aa4baeb33 to your computer and use it in GitHub Desktop.
$MyLibrarySet = "MyVariableSet"
#Create an instance of a Library Set Object
$libraryVariableSet = Get-OctopusResourceModel -Resource LibraryVariableSet
#Add mandatory properties to the object
$libraryVariableSet.Name = $MyLibrarySet
#Create the Library Set
New-OctopusResource -Resource $libraryVariableSet
#Get variable set asociated with the library variable set created above
$variableSet = Get-OctopusVariableSet -LibrarySetName $MyLibrarySet -resourceOnly
#Creating a variable
$var = New-Object Octopus.Client.Model.VariableResource
$var.Name = "MyVar"
$var.Value = "A value"
#add scope here
#Adding var to variable set
$variableSet.Variables.Add($var)
#Saving variable set
Update-OctopusResource -Resource $variableSet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment