Q:

Don't commit check-in if build status not green

We have gated check-ins with our build. Sometimes the builds are orange or red. When they're red, the changeset is rejected and not committed. When the build for the check-in is orange, the check-in is not rejected and instead committed. How do we configured TFS to not check-in a changeset that produces an orange build result?
I don't care about the reason for the orange. I just want to reject the check-in no matter what.

A:

You need to determine why the build is going orange and then decide if that is reason enough to fail the build.

For a CI build you should satisfy these 2 as a minimum

The Code Compiles without Errors (or warnings)
All Unit Tests Pass

Your question doesn't specify why your builds are actually partially succeeding.
If your unit tests aren't successful then you can tick the fail build box in the test window
BuildDefinition > Process > Test > Test Dialogue

if you want to custom fail the build you can add a SetBuildProperties to your workflow, within the build template
you can then choose which part of the build you want to fail, Status, or Test status.
This is an example of how I set Partially succeeded if the Code Coverage isn't high enough, but it shows the important parts

