While the words are used similarly, it's important to understand their underlying definitions, which describe different situations:
A "breach" is a break or opening in some kind of physical barrier. This barrier can be as basic as a wall to keep out enemies, or it can be something like the hull of a ship, designed to keep out water.
In any situation, a "breach" usually intentional, undesired, sudden, and sometimes violent. Examples:
The security software around the sensitive data was be breached by a computer hacker.
Security at the border has been breached by drug smugglers so frequently as to make it little more than a hindrance to law-abiding travelers.
The prison's walls were breached by industrious prisoners tunneling with hand tools.
Metaphorically, a contract (or treaty, or agreement) can be considered a wall between what is allowed and what is not allowed. If one party breaches the contract, is as if they have broken the wall, weakening the entire structure.
A "violation" is a more generic term, meaning to significantly break, weaken, disturb, or disregard something of importance. It's not a word to use lightly; for example, you might break a child's toy but you wouldn't say you violated it.
The meteor strike violated the integrity of the spaceship's hull, but the crew quickly patched up the damage.
A "breach" is a form of "violation", but, when talking about breaks in legal or social structures, "breach" tends to be used in situations where both parties agree to terms (like a contract or a treaty) while "violate" is used everything else, where the structures are more imposed on one side (like city laws, school rules, property rights, terms of service, etc.)
The VP's actions were a serious violation of the company's sexual harassment guidelines.
It would not be unusual to say instead that the VP breached the guidelines, although this might suggest the VP did so on purpose rather than through ignorance or negligence.
Side note: On top of the other differences, "violate" carries an additional meaning of "sexual assault". While this is not the case with something like:
They violated their software agreement by installing it on an unsupported hardware configuration
it is still something to keep in mind as the result can be unintentionally weird or humorous. For example:
The army violated the fortress walls
suggests something entirely different from, "the army breached the walls".