Q: Is there a way to validate a package is built off a particular branch as part of build in VSTS DevOps? As part of a project we are using some in-house npm packages. These have a simple branching strategy of 'develop', 'release' and 'master'. Our project will reference this package, but we want a way to make sure that when we go to release, that the package referenced has been built off the release branch for that package and not the develop one.
Is there a way to fail a build if the package hasn't been built of a given branch? 

A: So you want some way to tag your builds as "release candidate" when they come from specific release branch. There are many different ways to do this.
For example, Azure Pipelines has some built in variables:
https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
You see we have a variable : Build.SourceBranchName
You can use this in a number of ways. For example you could write this into a build-notes.txt and package it into your artifact. Or depending on how you package your artifacts, you may be able to tag this information in somewhere.
e.g. NPM supports something called dist-tag : https://docs.npmjs.com/cli/dist-tag
Your release pipeline then just needs some logic to read this and validate.
