I thought this was a very cleaver idea and set out to help. I already blogged how to set the Retain Indefinitely flag here
. So all we need is a PowerShell script to allow us to set the build quality. If you are using the agent based deployment you can add the AgentBasedSetBuildQualityPowerShell script as a custom tool. If you are using the vNext based deployment you can simply execute the vNextSetBuildQuality PowerShell using the PS/DSC action. When using a vNext based deployment the $tfsUrl, $teamProject and $buildDefinition values are automatically passed to all PowerShell scripts. When using the agent based solution you will need to add those as parameters when you add the PowerShell as a custom tool. You can then use the Helper Variables provided by Release Management to pass in the correct values. You can see an example of adding an agent based custom tool here
# The machine
you use to execute this PowerShell must have Team Explorer installed
# so that we
can load the needed assemblies.
# The [void]
stops the GAC messages from being output to screen.
# Connect to
"Connecting to $tfsUrl"
# Get the
# Find the
build used for this release
= $buildServer.CreateBuildDetailSpec($teamProject, $buildDefinition)
# Don't query
any additional information i.e. associated work items, associated changesets,
# Use the
build number to find the build
# Search for
# Make sure
we only found a single build
if($results.Builds.Count -eq 1)
$build.Quality = $buildQuality
"Build Quality set to $buildQuality"